Class MoreExecutors.DirectExecutorService
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- com.google.common.util.concurrent.AbstractListeningExecutorService
-
- com.google.common.util.concurrent.MoreExecutors.DirectExecutorService
-
- All Implemented Interfaces:
ListeningExecutorService,java.util.concurrent.Executor,java.util.concurrent.ExecutorService
- Enclosing class:
- MoreExecutors
private static final class MoreExecutors.DirectExecutorService extends AbstractListeningExecutorService
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.ObjectlockLock used whenever accessing the state variables (runningTasks, shutdown) of the executorprivate intrunningTasksprivate booleanshutdown
-
Constructor Summary
Constructors Modifier Constructor Description privateDirectExecutorService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanawaitTermination(long timeout, java.util.concurrent.TimeUnit unit)private voidendTask()Decrements the running task count.voidexecute(java.lang.Runnable command)booleanisShutdown()booleanisTerminated()voidshutdown()java.util.List<java.lang.Runnable>shutdownNow()private voidstartTask()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 com.google.common.util.concurrent.ListeningExecutorService
invokeAll, invokeAll
-
-
-
-
Method Detail
-
execute
public void execute(java.lang.Runnable command)
-
isShutdown
public boolean isShutdown()
-
shutdown
public void shutdown()
-
shutdownNow
public java.util.List<java.lang.Runnable> shutdownNow()
-
isTerminated
public boolean isTerminated()
-
awaitTermination
public boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
startTask
private void startTask()
Checks if the executor has been shut down and increments the running task count.- Throws:
java.util.concurrent.RejectedExecutionException- if the executor has been previously shutdown
-
endTask
private void endTask()
Decrements the running task count.
-
-