@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, waitpublic ListenableFuture<?> submit(java.lang.Runnable task)
submit in interface ListeningExecutorServicesubmit in interface java.util.concurrent.ExecutorServiceListenableFuture representing pending completion of the taskpublic <T> ListenableFuture<T> submit(java.lang.Runnable task, @Nullable T result)
submit in interface ListeningExecutorServicesubmit in interface java.util.concurrent.ExecutorServiceListenableFuture representing pending completion of the taskpublic <T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
submit in interface ListeningExecutorServicesubmit in interface java.util.concurrent.ExecutorServiceListenableFuture 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.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic <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.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException
ListeningExecutorServiceAll elements in the returned list must be ListenableFuture instances.
invokeAll in interface ListeningExecutorServiceinvokeAll in interface java.util.concurrent.ExecutorServiceListenableFuture 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.InterruptedExceptionpublic <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
ListeningExecutorServiceAll elements in the returned list must be ListenableFuture instances.
invokeAll in interface ListeningExecutorServiceinvokeAll in interface java.util.concurrent.ExecutorServiceListenableFuture 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