230 |
|
} |
231 |
|
|
232 |
|
/** |
233 |
– |
* Executes a Runnable task and returns a Future representing that |
234 |
– |
* task. |
235 |
– |
* |
236 |
– |
* @param executor the Executor to which the task will be submitted |
237 |
– |
* @param task the task to submit |
238 |
– |
* @param value the value which will become the return value of |
239 |
– |
* the task upon task completion |
240 |
– |
* @return a Future representing pending completion of the task |
241 |
– |
* @throws RejectedExecutionException if task cannot be scheduled |
242 |
– |
* for execution |
243 |
– |
*/ |
244 |
– |
public static <T> Future<T> execute(Executor executor, Runnable task, T value) { |
245 |
– |
FutureTask<T> ftask = new FutureTask<T>(task, value); |
246 |
– |
executor.execute(ftask); |
247 |
– |
return ftask; |
248 |
– |
} |
249 |
– |
|
250 |
– |
/** |
233 |
|
* Executes a value-returning task and returns a Future |
234 |
|
* representing the pending results of the task. |
235 |
|
* |