All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebean.SqlFutureList Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
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(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy