private static class MoreExecutors.DirectExecutorService extends AbstractListeningExecutorService
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.locks.Lock |
lock
Lock used whenever accessing the state variables
(runningTasks, shutdown, terminationCondition) of the executor
|
private int |
runningTasks |
private boolean |
shutdown |
private java.util.concurrent.locks.Condition |
termination
Signaled after the executor is shutdown and running tasks are done
|
Modifier | Constructor and Description |
---|---|
private |
DirectExecutorService() |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
private void |
endTask()
Decrements the running task count.
|
void |
execute(java.lang.Runnable command) |
boolean |
isShutdown() |
boolean |
isTerminated() |
void |
shutdown() |
java.util.List<java.lang.Runnable> |
shutdownNow() |
private void |
startTask()
Checks if the executor has been shut down and increments the running
task count.
|
newTaskFor, newTaskFor, submit, submit, submit
invokeAll, invokeAll, invokeAny, invokeAny
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invokeAll, invokeAll
private final java.util.concurrent.locks.Lock lock
private final java.util.concurrent.locks.Condition termination
private int runningTasks
private boolean shutdown
public void execute(java.lang.Runnable command)
public boolean isShutdown()
public void shutdown()
public java.util.List<java.lang.Runnable> shutdownNow()
public boolean isTerminated()
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException
private void startTask()
java.util.concurrent.RejectedExecutionException
- if the executor has been previously
shutdownprivate void endTask()