Class DirectExecutorService

All Implemented Interfaces:
ListeningExecutorService, AutoCloseable, Executor, ExecutorService

final class DirectExecutorService extends AbstractListeningExecutorService
See newDirectExecutorService javadoc for behavioral notes.
  • Field Details

    • lock

      private final Object 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

      public void execute(Runnable command)
    • isShutdown

      public boolean isShutdown()
    • shutdown

      public void shutdown()
    • shutdownNow

      public List<Runnable> shutdownNow()
    • isTerminated

      public boolean isTerminated()
    • awaitTermination

      public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
      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.