com.google.common.util.concurrent
Interface ListeningExecutorService
- All Superinterfaces:
- java.util.concurrent.Executor, java.util.concurrent.ExecutorService
- All Known Subinterfaces:
- ListeningScheduledExecutorService
- All Known Implementing Classes:
- ForwardingListeningExecutorService
public interface ListeningExecutorService
- extends java.util.concurrent.ExecutorService
An ExecutorService
that returns ListenableFuture
instances. To create an instance
from an existing ExecutorService
, call
MoreExecutors.listeningDecorator(ExecutorService)
.
- Since:
- 10.0
Method Summary |
<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)
|
|
submit(java.util.concurrent.Callable<T> task)
|
ListenableFuture<?> |
submit(java.lang.Runnable task)
|
|
submit(java.lang.Runnable task,
T result)
|
Methods inherited from interface java.util.concurrent.ExecutorService |
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow |
Methods inherited from interface java.util.concurrent.Executor |
execute |
submit
<T> ListenableFuture<T> submit(java.util.concurrent.Callable<T> task)
- Specified by:
submit
in interface java.util.concurrent.ExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
- Throws:
java.util.concurrent.RejectedExecutionException
submit
ListenableFuture<?> submit(java.lang.Runnable task)
- Specified by:
submit
in interface java.util.concurrent.ExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
- Throws:
java.util.concurrent.RejectedExecutionException
submit
<T> ListenableFuture<T> submit(java.lang.Runnable task,
T result)
- Specified by:
submit
in interface java.util.concurrent.ExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
- Throws:
java.util.concurrent.RejectedExecutionException
invokeAll
<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.
- Specified by:
invokeAll
in interface java.util.concurrent.ExecutorService
- Returns:
- A list of
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.
- Throws:
java.util.concurrent.RejectedExecutionException
java.lang.NullPointerException
- if any task is null
java.lang.InterruptedException
invokeAll
<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.
- Specified by:
invokeAll
in interface java.util.concurrent.ExecutorService
- Returns:
- a list of
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.
- Throws:
java.util.concurrent.RejectedExecutionException
java.lang.NullPointerException
- if any task is null
java.lang.InterruptedException