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.ForwardingExecutorService
public <T> Future<T> submit(Callable<T> task)
submit
in interface ExecutorService
submit
in class com.google.common.util.concurrent.ForwardingExecutorService
public <T> Future<T> submit(Runnable task, T result)
submit
in interface ExecutorService
submit
in class com.google.common.util.concurrent.ForwardingExecutorService
public Future<?> submit(Runnable task)
submit
in interface ExecutorService
submit
in class com.google.common.util.concurrent.ForwardingExecutorService
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll
in interface ExecutorService
invokeAll
in class com.google.common.util.concurrent.ForwardingExecutorService
InterruptedException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll
in interface ExecutorService
invokeAll
in class com.google.common.util.concurrent.ForwardingExecutorService
InterruptedException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny
in interface ExecutorService
invokeAny
in class com.google.common.util.concurrent.ForwardingExecutorService
InterruptedException
ExecutionException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny
in interface ExecutorService
invokeAny
in class com.google.common.util.concurrent.ForwardingExecutorService
InterruptedException
ExecutionException
TimeoutException
public 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.InterruptedException
public boolean isCompleted()
true
if all submitted jobs have completed, false
otherwise.Copyright © 2019 OpenDaylight. All rights reserved.