@GwtIncompatible 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<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks) |
<T> List<Future<T>> |
invokeAll(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
<T> ListenableFuture<T> |
submit(Callable<T> task) |
ListenableFuture<?> |
submit(Runnable task) |
<T> ListenableFuture<T> |
submit(Runnable task,
T result) |
awaitTermination, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow
<T> ListenableFuture<T> submit(Callable<T> task)
submit
in interface ExecutorService
ListenableFuture
representing pending completion of the taskRejectedExecutionException
ListenableFuture<?> submit(Runnable task)
submit
in interface ExecutorService
ListenableFuture
representing pending completion of the taskRejectedExecutionException
<T> ListenableFuture<T> submit(Runnable task, T result)
submit
in interface ExecutorService
ListenableFuture
representing pending completion of the taskRejectedExecutionException
<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 nullInterruptedException
<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 nullInterruptedException
Copyright © 2010-2017. All Rights Reserved.