public class SubExecutorService extends Object implements ExecutorService
ExecutorService
into a smaller sub-executor service. This
allows to submit tasks to the underlying executor service while the shutdown related methods are
scoped only to the subset of tasks submitted through this sub-executor:
shutdown()
– shutdowns this sub-executor only.
isShutdown()
and isTerminated()
– report status of this sub-executor
only.
awaitTermination(long, TimeUnit)
– awaits for tasks submitted through this
sub-executor only.
Modifier and Type | Class and Description |
---|---|
protected class |
SubExecutorService.CallableTask<V> |
protected class |
SubExecutorService.RunnableTask<V> |
protected static interface |
SubExecutorService.Task<V> |
Constructor and Description |
---|
SubExecutorService(ExecutorService executorService)
Constructs a new SubExecutorService for the given executor service.
|
Modifier and Type | Method and Description |
---|---|
protected void |
acquireAlive() |
boolean |
awaitTermination(long timeout,
TimeUnit unit) |
void |
execute(Runnable command) |
protected ExecutorService |
getExecutorService() |
<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) |
protected boolean |
isAlive() |
protected boolean |
isRunning() |
boolean |
isShutdown() |
boolean |
isTerminated() |
protected <T extends SubExecutorService.Task> |
register(T task) |
protected void |
releaseAlive() |
void |
shutdown() |
List<Runnable> |
shutdownNow() |
protected void |
shutdownTasks(Set<SubExecutorService.Task> tasks) |
<T> Future<T> |
submit(Callable<T> task) |
Future<?> |
submit(Runnable task) |
<T> Future<T> |
submit(Runnable task,
T result) |
protected <T> T |
throwRejected(Object task) |
String |
toString() |
protected void |
unregister(SubExecutorService.Task task) |
public SubExecutorService(ExecutorService executorService)
executorService
- the underlying executor service to submit tasks topublic void shutdown()
shutdown
in interface ExecutorService
public List<Runnable> shutdownNow()
shutdownNow
in interface ExecutorService
public boolean isShutdown()
isShutdown
in interface ExecutorService
public boolean isTerminated()
isTerminated
in interface ExecutorService
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
awaitTermination
in interface ExecutorService
InterruptedException
public <T> Future<T> submit(Callable<T> task)
submit
in interface ExecutorService
public <T> Future<T> submit(Runnable task, T result)
submit
in interface ExecutorService
public Future<?> submit(Runnable task)
submit
in interface ExecutorService
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException
invokeAll
in interface ExecutorService
InterruptedException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
invokeAny
in interface ExecutorService
InterruptedException
ExecutionException
TimeoutException
protected void acquireAlive()
protected void releaseAlive()
protected boolean isAlive()
protected boolean isRunning()
protected ExecutorService getExecutorService()
protected <T> T throwRejected(Object task)
protected <T extends SubExecutorService.Task> T register(T task)
protected void unregister(SubExecutorService.Task task)
protected void shutdownTasks(Set<SubExecutorService.Task> tasks)
Copyright © 2009–2020 OrientDB. All rights reserved.