mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
#217 - ENH: Restore findFutureList() removing its previous deprecated status. Change implementation to use its own PersistenceContext (aka PersistenceContextScope.QUERY)
This commit is contained in:
1 parent
dd30b43d59
commit
8237072f5b
9 files changed
+399
-141
No files matched your search
@@ -1,12 +1,17 @@
|
||||
package com.avaje.ebeaninternal.server.query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import com.avaje.ebean.FutureList;
|
||||
import com.avaje.ebean.Query;
|
||||
import com.avaje.ebean.Transaction;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
/**
|
||||
* Default implementation for FutureList.
|
||||
*/
|
||||
@@ -26,15 +31,38 @@ public class QueryFutureList<T> extends BaseFuture<List<T>> implements FutureLis
|
||||
public Transaction getTransaction() {
|
||||
return call.transaction;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Query<T> getQuery() {
|
||||
return call.query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancel(boolean mayInterruptIfRunning) {
|
||||
call.query.cancel();
|
||||
return super.cancel(mayInterruptIfRunning);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getUnchecked() {
|
||||
try {
|
||||
return get();
|
||||
} catch (InterruptedException e) {
|
||||
throw new PersistenceException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> getUnchecked(long timeout, TimeUnit unit) throws TimeoutException {
|
||||
try {
|
||||
return get(timeout, unit);
|
||||
} catch (InterruptedException e) {
|
||||
throw new PersistenceException(e);
|
||||
} catch (ExecutionException e) {
|
||||
throw new PersistenceException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user