@Beta public abstract class AbstractListeningExecutorService extends java.lang.Object implements ListeningExecutorService
ListeningExecutorService
execution methods atop the abstract Executor.execute(java.lang.Runnable)
method. More concretely, the submit
, invokeAny
and invokeAll
methods
create ListenableFutureTask
instances and pass them to Executor.execute(java.lang.Runnable)
.
In addition to Executor.execute(java.lang.Runnable)
, subclasses must implement all methods related to shutdown and
termination.
Constructor and Description |
---|
AbstractListeningExecutorService() |
Modifier and Type | Method and Description |
---|---|
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
<T> ListenableFuture<T> |
submit(java.util.concurrent.Callable<T> task) |
ListenableFuture<?> |
submit(java.lang.Runnable task) |
<T> ListenableFuture<T> |
submit(java.lang.Runnable task,
T result) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ListenableFuture<?> submit(java.lang.Runnable task)
submit
in interface ListeningExecutorService
submit
in interface java.util.concurrent.ExecutorService
ListenableFuture
representing pending completion of the taskpublic <T> ListenableFuture<T> submit(java.lang.Runnable task, @Nullable T result)
submit
in interface ListeningExecutorService
submit
in interface java.util.concurrent.ExecutorService
ListenableFuture
representing pending completion of the taskpublic <T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
submit
in interface ListeningExecutorService
submit
in interface java.util.concurrent.ExecutorService
ListenableFuture
representing pending completion of the taskpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException
invokeAny
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
java.util.concurrent.ExecutionException
public <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException, java.util.concurrent.ExecutionException, java.util.concurrent.TimeoutException
invokeAny
in interface java.util.concurrent.ExecutorService
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException
public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) throws java.lang.InterruptedException
ListeningExecutorService
All elements in the returned list must be ListenableFuture
instances.
invokeAll
in interface ListeningExecutorService
invokeAll
in interface java.util.concurrent.ExecutorService
ListenableFuture
instances representing the tasks, in the same
sequential order as produced by the iterator for the given task list, each of which has
completed.java.lang.InterruptedException
public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
ListeningExecutorService
All elements in the returned list must be ListenableFuture
instances.
invokeAll
in interface ListeningExecutorService
invokeAll
in interface java.util.concurrent.ExecutorService
ListenableFuture
instances representing the tasks, in the same
sequential order as produced by the iterator for the given task list. If the operation
did not time out, each task will have completed. If it did time out, some of these
tasks will not have completed.java.lang.InterruptedException