mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - code cleanup - BeanIdList - removed unused methods
This commit is contained in:
@@ -1,68 +1,19 @@
|
||||
package com.avaje.ebeaninternal.api;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
/**
|
||||
* Wrapper of the list of Id's adding support for background fetching
|
||||
* future object.
|
||||
*
|
||||
* @author rbygrave
|
||||
* Wrapper of the list of Id's.
|
||||
*/
|
||||
public class BeanIdList {
|
||||
|
||||
private final List<Object> idList;
|
||||
|
||||
private boolean hasMore = true;
|
||||
|
||||
private FutureTask<Integer> fetchFuture;
|
||||
|
||||
|
||||
private boolean hasMore;
|
||||
|
||||
public BeanIdList(List<Object> idList) {
|
||||
this.idList = idList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the fetch is continuing in a background thread.
|
||||
*/
|
||||
public boolean isFetchingInBackground() {
|
||||
return fetchFuture != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the FutureTask that is continuing the fetch in a background thread.
|
||||
*/
|
||||
public void setBackgroundFetch(FutureTask<Integer> fetchFuture) {
|
||||
this.fetchFuture = fetchFuture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for the background fetching to complete with a timeout.
|
||||
*/
|
||||
public void backgroundFetchWait(long wait, TimeUnit timeUnit) {
|
||||
if (fetchFuture != null){
|
||||
try {
|
||||
fetchFuture.get(wait, timeUnit);
|
||||
} catch (Exception e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for the background fetching to complete.
|
||||
*/
|
||||
public void backgroundFetchWait() {
|
||||
if (fetchFuture != null){
|
||||
try {
|
||||
fetchFuture.get();
|
||||
} catch (Exception e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an Id to the list.
|
||||
@@ -91,5 +42,5 @@ public class BeanIdList {
|
||||
public void setHasMore(boolean hasMore) {
|
||||
this.hasMore = hasMore;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class CQueryEngine {
|
||||
request.getTransaction().logSummary(rcQuery.getSummary());
|
||||
}
|
||||
|
||||
if (!list.isFetchingInBackground() && request.getQuery().isFutureFetch()) {
|
||||
if (request.getQuery().isFutureFetch()) {
|
||||
// end the transaction for futureFindIds (it had it's own one)
|
||||
logger.debug("Future findIds completed!");
|
||||
request.getTransaction().end();
|
||||
|
||||
Reference in New Issue
Block a user