public abstract class DelegatingExecutorService extends Wrapper<ExecutorService> implements ExecutorService
ExecutorService implementations by
forwarding all methods to a delegate executor service.wrapper methods for all complex input (e.g. Callable, Runnable)
and result types (e.g. Future).
Although this class does implements all required methods of ExecutorService it is still declared
as an abstract class.
This is because it does not provide any value in itself.
| Modifier | Constructor and Description |
|---|---|
protected |
DelegatingExecutorService(ExecutorService delegate)
Creates a new executor service that delegates all methods to the specified
delegate. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
boolean |
equals(Object other) |
void |
execute(Runnable command) |
int |
hashCode() |
<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 |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
String |
toString() |
protected <T> Callable<T> |
wrap(Callable<T> source) |
protected <T> Future<T> |
wrap(Future<T> source) |
protected Runnable |
wrap(Runnable source) |
protected <T> List<Future<T>> |
wrapFutures(Collection<? extends Future<T>> futures)
Default way of mapping a
Collection of Future objects:
Create a new list and add each individually wrapped object into it. |
protected <T> Collection<? extends Callable<T>> |
wrapTasks(Collection<? extends Callable<T>> tasks)
Default way of mapping a
Collection of Callable objects:
Create a new collection and add each individually wrapped object into it. |
delegate, nonNullDelegateprotected DelegatingExecutorService(ExecutorService delegate)
delegate.delegate - The delegate ExecutorService being wrapped.
This may only be null if the delegate() method is
overridden to provide an alternative non-null result.Wrapper.delegate()protected <T> Collection<? extends Callable<T>> wrapTasks(Collection<? extends Callable<T>> tasks)
Collection of Callable objects:
Create a new collection and add each individually wrapped object into it.T - The common result type for the collection of tasks.tasks - The tasks to be mapped.wrap(Callable)protected <T> List<Future<T>> wrapFutures(Collection<? extends Future<T>> futures)
Collection of Future objects:
Create a new list and add each individually wrapped object into it.T - The common result type for the collection of futures.futures - The futures to be mapped.wrap(Future)public void shutdown()
shutdown in interface ExecutorServicepublic List<Runnable> shutdownNow()
shutdownNow in interface ExecutorServicepublic boolean isShutdown()
isShutdown in interface ExecutorServicepublic boolean isTerminated()
isTerminated in interface ExecutorServicepublic boolean awaitTermination(long timeout,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface ExecutorServiceInterruptedExceptionpublic <T> Future<T> submit(Callable<T> task)
submit in interface ExecutorServicepublic <T> Future<T> submit(Runnable task, T result)
submit in interface ExecutorServicepublic Future<?> submit(Runnable task)
submit in interface ExecutorServicepublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll in interface ExecutorServiceInterruptedExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionpublic <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny in interface ExecutorServiceInterruptedExceptionExecutionExceptionTimeoutExceptionpublic int hashCode()
hashCode in class Wrapper<ExecutorService>public boolean equals(Object other)
equals in class Wrapper<ExecutorService>public String toString()
toString in class Wrapper<ExecutorService>Copyright © 2016–2017 Talsma ICT. All rights reserved.