public interface SqlFutureList extends Future<List<SqlRow>>
It extends the java.util.concurrent.Future.
// create a query
String sql = ... ;
SqlQuery sqlQuery = Ebean.createSqlQuery(sql);
// execute the query in a background thread
SqlFutureList sqlFuture = sqlQuery.findFutureList();
// do something else ... we will sleep
Thread.sleep(3000);
System.out.println("end of sleep");
if (!futureList.isDone()){
// we can cancel the query execution
futureList.cancel(true);
}
System.out.println("and... done:"+futureList.isDone());
if (!futureList.isCancelled()){
// wait for the query to finish and return the list
List<SqlRow> list = futureList.get();
System.out.println("list:"+list);
}
| Modifier and Type | Method and Description |
|---|---|
SqlQuery |
getQuery() |
Copyright © 2016. All rights reserved.