Class DirectExecutorService
java.lang.Object
java.util.concurrent.AbstractExecutorService
com.google.common.util.concurrent.AbstractListeningExecutorService
com.google.common.util.concurrent.DirectExecutorService
- All Implemented Interfaces:
ListeningExecutorService
,AutoCloseable
,Executor
,ExecutorService
See newDirectExecutorService javadoc for behavioral notes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Object
Lock used whenever accessing the state variables (runningTasks, shutdown) of the executorprivate int
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitTermination
(long timeout, TimeUnit unit) private void
endTask()
Decrements the running task count.void
boolean
boolean
void
shutdown()
private void
Checks if the executor has been shut down and increments the running task count.Methods inherited from class com.google.common.util.concurrent.AbstractListeningExecutorService
newTaskFor, newTaskFor, submit, submit, submit
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.concurrent.ExecutorService
close, invokeAny, invokeAny
Methods inherited from interface com.google.common.util.concurrent.ListeningExecutorService
awaitTermination, invokeAll, invokeAll, invokeAll, invokeAny
-
Field Details
-
lock
Lock used whenever accessing the state variables (runningTasks, shutdown) of the executor -
runningTasks
private int runningTasks -
shutdown
private boolean shutdown
-
-
Constructor Details
-
DirectExecutorService
DirectExecutorService()
-
-
Method Details
-
execute
-
isShutdown
public boolean isShutdown() -
shutdown
public void shutdown() -
shutdownNow
-
isTerminated
public boolean isTerminated() -
awaitTermination
- Throws:
InterruptedException
-
startTask
private void startTask()Checks if the executor has been shut down and increments the running task count.- Throws:
RejectedExecutionException
- if the executor has been previously shutdown
-
endTask
private void endTask()Decrements the running task count.
-