com.google.common.util.concurrent
Interface ListeningExecutorService
- All Superinterfaces:
- Executor, ExecutorService
- All Known Subinterfaces:
- ListeningScheduledExecutorService
- All Known Implementing Classes:
- ForwardingListeningExecutorService
public interface ListeningExecutorService
- extends ExecutorService
An ExecutorService
that returns ListenableFuture
instances. To create an instance
from an existing ExecutorService
, call
MoreExecutors.listeningDecorator(ExecutorService)
.
- Since:
- 10.0
- Author:
- Chris Povirk
submit
<T> ListenableFuture<T> submit(Callable<T> task)
- Specified by:
submit
in interface ExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
- Throws:
RejectedExecutionException
submit
ListenableFuture<?> submit(Runnable task)
- Specified by:
submit
in interface ExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
- Throws:
RejectedExecutionException
submit
<T> ListenableFuture<T> submit(Runnable task,
T result)
- Specified by:
submit
in interface ExecutorService
- Returns:
- a
ListenableFuture
representing pending completion of the task
- Throws:
RejectedExecutionException
invokeAll
<T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks)
throws InterruptedException
-
All elements in the returned list must be ListenableFuture
instances.
- Specified by:
invokeAll
in interface 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:
RejectedExecutionException
NullPointerException
- if any task is null
InterruptedException
invokeAll
<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.
- Specified by:
invokeAll
in interface 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:
RejectedExecutionException
NullPointerException
- if any task is null
InterruptedException
Copyright © 2010-2012. All Rights Reserved.