#681 - Remove SqlQuery.cancel() ... migrate to SqlQuery.findEachWhile() and stop while iterating

This commit is contained in:
Robin Bygrave committed 2016-04-29 09:05:36 +12:00
1 parent 5cf2d3c39a
commit bf75af85c1
5 files changed
+42 -144

No files matched your search

@@ -7,9 +7,7 @@ import com.avaje.ebean.SqlRow;
import com.avaje.ebeaninternal.api.BindParams;
import com.avaje.ebeaninternal.api.SpiSqlQuery;
import javax.persistence.PersistenceException;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
/**
@@ -29,10 +27,6 @@ public class DefaultRelationalQuery implements SpiSqlQuery {
private int timeout;
private boolean futureFetch;
private boolean cancelled;
/**
* For the purposes of cancelling the query.
*/
@@ -134,37 +128,10 @@ public class DefaultRelationalQuery implements SpiSqlQuery {
return query;
}
public boolean isFutureFetch() {
return futureFetch;
}
public void setFutureFetch(boolean futureFetch) {
this.futureFetch = futureFetch;
}
public void setPreparedStatement(PreparedStatement pstmt) {
synchronized (this) {
this.pstmt = pstmt;
}
}
public void cancel() {
synchronized (this) {
this.cancelled = true;
if (pstmt != null) {
try {
pstmt.cancel();
} catch (SQLException e) {
throw new PersistenceException("Error cancelling query", e);
}
}
}
}
public boolean isCancelled() {
synchronized (this) {
return cancelled;
}
}
}