There are two approaches to submitting and polling task for result
FutureTask futureTask = new FutureTask(callable);
Almost certainly none at all. A quick browse on GrepCode of the AbstractExecutorService
shows each of these methods are simply helper methods that ultimately wrap the Callable
/Runnable
in a Future
for you.
protected RunnableFuture newTaskFor(Runnable runnable, T value) {
return new FutureTask(runnable, value);
}
protected RunnableFuture newTaskFor(Callable callable) {
return new FutureTask(callable);
}
public Future> submit(Runnable task) {
// ...
RunnableFuture