ExecutorService that allows subclasses to wrap tasks before they are submitted to the underlying executor.
Note that task wrapping may occur even if the task is never executed.
For delegation without task-wrapping, see ForwardingExecutorService.
| Modifier and Type | Field and Description |
|---|---|
| private final ExecutorService |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | awaitTermination(long
the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public final void | execute(Runnable
the runnable task command)Implements java. |
| public final <T extends @Nullable Object> List | invokeAll(Collection<? extends Callable<T>>
the collection of tasks tasks)Implements java. |
| public final <T extends @Nullable Object> List | invokeAll(Collection<? extends Callable<T>>
the collection of tasks tasks, long the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public final <T extends @Nullable Object> T | invokeAny(Collection<? extends Callable<T>>
the collection of tasks tasks)Implements java. |
| public final <T extends @Nullable Object> T | invokeAny(Collection<? extends Callable<T>>
the collection of tasks tasks, long the maximum time to wait timeout, TimeUnit the time unit of the timeout argument unit)Implements java. |
| public final boolean | isShutdown()
Implements java. true if this executor has been shut down.
|
| public final boolean | isTerminated()
Implements java. true if all tasks have completed following shut down.
|
| public final void | shutdown()
Implements java. |
| public final List | shutdownNow()
Implements java. |
| public final <T extends @Nullable Object> Future | submit(Callable<T>
the task to submit task)Implements java. |
| public final Future | submit(Runnable
the task to submit task)Implements java. |
| public final <T extends @Nullable Object> Future | submit(Runnable
the task to submit task, T the result to return result)Implements java. |
| protected abstract <T extends @Nullable Object> Callable | |
| protected Runnable | |
| private <T extends @Nullable Object> ImmutableList |
| delegate | back to summary |
|---|---|
| private final ExecutorService delegate | |
| WrappingExecutorService | back to summary |
|---|---|
| protected WrappingExecutorService(ExecutorService delegate) | |
| awaitTermination | back to summary |
|---|---|
| public final boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException Implements java. Doc from java. Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.
| |
| execute | back to summary |
|---|---|
| public final void execute(Runnable command) Implements java. Doc from java. Executes the given command at some time in the future. The command
may execute in a new thread, in a pooled thread, or in the calling
thread, at the discretion of the | |
| invokeAll | back to summary |
|---|---|
| public final <T extends @Nullable Object> List Implements java. Doc from java. Executes the given tasks, returning a list of Futures holding
their status and results when all complete.
| |
| invokeAll | back to summary |
|---|---|
| public final <T extends @Nullable Object> List Implements java. Doc from java. Executes the given tasks, returning a list of Futures holding
their status and results
when all complete or the timeout expires, whichever happens first.
| |
| invokeAny | back to summary |
|---|---|
| public final <T extends @Nullable Object> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException Implements java. Doc from java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
| |
| invokeAny | back to summary |
|---|---|
| public final <T extends @Nullable Object> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Implements java. Doc from java. Executes the given tasks, returning the result of one that has completed successfully (i.e., without throwing an exception), if any do before the given timeout elapses. Upon normal or exceptional return, tasks that have not completed are cancelled. The results of this method are undefined if the given collection is modified while this operation is in progress.
| |
| isShutdown | back to summary |
|---|---|
| public final boolean isShutdown() Implements java. Doc from java. Returns
| |
| isTerminated | back to summary |
|---|---|
| public final boolean isTerminated() Implements java. Doc from java. Returns
| |
| shutdown | back to summary |
|---|---|
| public final void shutdown() Implements java. Doc from java. Initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted. Invocation has no additional effect if already shut down. This method does not wait for previously submitted tasks to
complete execution. Use
| |
| shutdownNow | back to summary |
|---|---|
| public final List Implements java. Doc from java. Attempts to stop all actively executing tasks, halts the processing of waiting tasks, and returns a list of the tasks that were awaiting execution. This method does not wait for actively executing tasks to
terminate. Use There are no guarantees beyond best-effort attempts to stop
processing actively executing tasks. For example, typical
implementations will cancel via | |
| submit | back to summary |
|---|---|
| public final <T extends @Nullable Object> Future Implements java. Doc from java. Submits a value-returning task for execution and returns a
Future representing the pending results of the task. The
Future's
If you would like to immediately block waiting
for a task, you can use constructions of the form
Note The | |
| submit | back to summary |
|---|---|
| public final Future Implements java. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's | |
| submit | back to summary |
|---|---|
| public final <T extends @Nullable Object> Future Implements java. Doc from java. Submits a Runnable task for execution and returns a Future
representing that task. The Future's | |
| wrapTask | back to summary |
|---|---|
| protected abstract <T extends @Nullable Object> Callable Wraps a | |
| wrapTask | back to summary |
|---|---|
| protected Runnable wrapTask(Runnable command) Wraps a | |
| wrapTasks | back to summary |
|---|---|
| private <T extends @Nullable Object> ImmutableList Wraps a collection of tasks.
| |