public interface ListeningExecutorService extends ExecutorService
ExecutorService
that returns
ListenableFuture
instances. To create an instance from an existing
ExecutorService
, call
MoreExecutors.listeningDecorator(ExecutorService)
.
Modifier and Type | Method and Description |
---|---|
<T> List |
invokeAll(Collection
|
<T> List |
invokeAll(Collection
|
<T> ListenableFuture |
submit(Callable
|
ListenableFuture |
submit(Runnable
|
<T> ListenableFuture |
submit(Runnable
|
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
<T> ListenableFuture<T> submit(Callable <T> task)
submit
in interface
ExecutorService
ListenableFuture
representing pending completion of the task
RejectedExecutionException
-
ListenableFuture<?> submit(Runnable task)
submit
in interface
ExecutorService
ListenableFuture
representing pending completion of the task
RejectedExecutionException
-
<T> ListenableFuture<T> submit(Runnable task, T result)
submit
in interface
ExecutorService
ListenableFuture
representing pending completion of the task
RejectedExecutionException
-
<T> List<Future <T>> invokeAll(Collection <? extends Callable <T>> tasks) throws InterruptedException
All elements in the returned list must be ListenableFuture
instances. The easiest way to obtain a List<ListenableFuture<T>>
from this method is an unchecked (but safe) cast:
@SuppressWarnings("unchecked") // guaranteed by invokeAll contract
List<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks);
invokeAll
in interface
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.
RejectedExecutionException
-
NullPointerException
- if any task is null
InterruptedException
<T> List<Future <T>> invokeAll(Collection <? extends Callable <T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
All elements in the returned list must be ListenableFuture
instances. The easiest way to obtain a List<ListenableFuture<T>>
from this method is an unchecked (but safe) cast:
@SuppressWarnings("unchecked") // guaranteed by invokeAll contract
List<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks, timeout, unit);
invokeAll
in interface
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.
RejectedExecutionException
-
NullPointerException
- if any task is null
InterruptedException