public interface ListeningExecutorService
extends java.util.concurrent.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> 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> 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) |
<T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
submit in interface java.util.concurrent.ExecutorServiceListenableFuture representing pending completion of the taskjava.util.concurrent.RejectedExecutionExceptionListenableFuture<?> submit(java.lang.Runnable task)
submit in interface java.util.concurrent.ExecutorServiceListenableFuture representing pending completion of the taskjava.util.concurrent.RejectedExecutionException<T> ListenableFuture<T> submit(java.lang.Runnable task, T result)
submit in interface java.util.concurrent.ExecutorServiceListenableFuture representing pending completion of the taskjava.util.concurrent.RejectedExecutionException<T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.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 contractList<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks);
invokeAll 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.util.concurrent.RejectedExecutionExceptionjava.lang.NullPointerException - if any task is nulljava.lang.InterruptedException<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
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 contractList<ListenableFuture<T>> futures = (List) executor.invokeAll(tasks, timeout, unit);
invokeAll 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.util.concurrent.RejectedExecutionExceptionjava.lang.NullPointerException - if any task is nulljava.lang.InterruptedException