public class AwaitableExecutorService
extends com.google.common.util.concurrent.ForwardingExecutorService
| Constructor and Description |
|---|
AwaitableExecutorService(ExecutorService delegate)
Create a new wrapper for the given
ExecutorService, adding the ability to wait for
job completion. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitCompletion(long timeout,
TimeUnit unit)
Wait for completion: this method will wait until all submitted jobs have completed, subject to the provided
timeout.
|
protected ExecutorService |
delegate() |
void |
execute(Runnable command) |
<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> T |
invokeAny(Collection<? extends Callable<T>> tasks) |
<T> T |
invokeAny(Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit) |
boolean |
isCompleted()
Indicates whether all submitted jobs have completed.
|
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
public AwaitableExecutorService(ExecutorService delegate)
ExecutorService, adding the ability to wait for
job completion.delegate - The executor service to wrap.protected ExecutorService delegate()
delegate in class com.google.common.util.concurrent.ForwardingExecutorServicepublic <T> Future<T> submit(Callable<T> task)
submit in interface ExecutorServicesubmit in class com.google.common.util.concurrent.ForwardingExecutorServicepublic <T> Future<T> submit(Runnable task, T result)
submit in interface ExecutorServicesubmit in class com.google.common.util.concurrent.ForwardingExecutorServicepublic Future<?> submit(Runnable task)
submit in interface ExecutorServicesubmit in class com.google.common.util.concurrent.ForwardingExecutorServicepublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll in interface ExecutorServiceinvokeAll in class com.google.common.util.concurrent.ForwardingExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll in interface ExecutorServiceinvokeAll in class com.google.common.util.concurrent.ForwardingExecutorServiceInterruptedExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny in interface ExecutorServiceinvokeAny in class com.google.common.util.concurrent.ForwardingExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny in interface ExecutorServiceinvokeAny in class com.google.common.util.concurrent.ForwardingExecutorServiceInterruptedExceptionExecutionExceptionTimeoutExceptionpublic void execute(Runnable command)
public boolean awaitCompletion(long timeout,
TimeUnit unit)
throws InterruptedException
timeout - The maximum time to wait.unit - The unit used for the timeout.true if the submitted jobs have completed, false if they haven’t.InterruptedExceptionpublic boolean isCompleted()
true if all submitted jobs have completed, false otherwise.Copyright © 2019 OpenDaylight. All rights reserved.