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
@GwtIncompatible private static final class MoreExecutors.DirectExecutorService extends AbstractListeningExecutorService
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
lock
Lock used whenever accessing the state variables (runningTasks, shutdown) of the executorprivate int
runningTasks
private boolean
shutdown
-
Constructor Summary
Constructors Modifier Constructor Description private
DirectExecutorService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
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.
-
-