@Beta public final class ExecutionSequencer extends Object
Futures returned from them)
have completed.
This class implements a superset of the behavior of MoreExecutors.newSequentialExecutor(java.util.concurrent.Executor). If your tasks all run on the same underlying executor and
don't need to wait for Futures returned from AsyncCallables, use it instead.
| Modifier and Type | Method and Description |
|---|---|
static ExecutionSequencer |
create()
Creates a new instance.
|
<T> ListenableFuture<T> |
submit(Callable<T> callable,
Executor executor)
Enqueues a task to run when the previous task (if any) completes.
|
<T> ListenableFuture<T> |
submitAsync(AsyncCallable<T> callable,
Executor executor)
Enqueues a task to run when the previous task (if any) completes.
|
public static ExecutionSequencer create()
public <T> ListenableFuture<T> submit(Callable<T> callable, Executor executor)
Cancellation does not propagate from the output future to a callable that has begun to
execute, but if the output future is cancelled before Callable.call() is invoked,
Callable.call() will not be invoked.
public <T> ListenableFuture<T> submitAsync(AsyncCallable<T> callable, Executor executor)
Cancellation does not propagate from the output future to the future returned from callable or a callable that has begun to execute, but if the output future is cancelled before
AsyncCallable.call() is invoked, AsyncCallable.call() will not be invoked.
Copyright © 2010–2019. All rights reserved.