com.avaje.ebean.SqlFutureList Maven / Gradle / Ivy
package com.avaje.ebean;
import java.util.List;
import java.util.concurrent.Future;
/**
* The SqlFutureList represents the result of a background SQL query execution.
*
*
* 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);
* }
*
*
*
* @author rob
*
*/
public interface SqlFutureList extends Future> {
SqlQuery getQuery();
}