com.hammurapi.common.concurrent

## Class NonQueueingThreadPoolExecutorService

- java.lang.Object
- - java.util.concurrent.AbstractExecutorService
  - - com.hammurapi.common.concurrent.NonQueueingThreadPoolExecutorService

- All Implemented Interfaces:
    Executor, ExecutorService

      public class NonQueueingThreadPoolExecutorService
      extends AbstractExecutorService

  This class does not queue jobs - it either executes them immediately in a background thread or in a caller thread if all background threads are busy.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NonQueueingThreadPoolExecutorService(ThreadFactory threadFactory, int size)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `awaitTermination(long timeout, TimeUnit unit)`
    `void` | `execute(Runnable command)`
    `protected void` | `handleException(Runnable task, Exception e)`
    `protected void` | `handleInterruptedException(InterruptedException e)`
    `boolean` | `isShutdown()`
    `boolean` | `isTerminated()`
    `protected <T> RunnableFuture<T>` | `newTaskFor(Callable<T> callable)`
    `protected <T> RunnableFuture<T>` | `newTaskFor(Runnable runnable, T value)`
    `protected void` | `onRejectedExecution(Runnable command)` This method is invoked when all threads are busy and cannot accept command for immediate execution.
    `void` | `shutdown()`
    `List<Runnable>` | `shutdownNow()`

    - ### Methods inherited from class java.util.concurrent.AbstractExecutorService

      `invokeAll, invokeAll, invokeAny, invokeAny, submit, submit, submit`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NonQueueingThreadPoolExecutorService

          public NonQueueingThreadPoolExecutorService(ThreadFactory threadFactory,
                                              int size)

  - ### Method Detail

    - #### shutdown

          public void shutdown()

    - #### shutdownNow

          public List<Runnable> shutdownNow()

    - #### isShutdown

          public boolean isShutdown()

    - #### isTerminated

          public boolean isTerminated()

    - #### awaitTermination

          public boolean awaitTermination(long timeout,
                                 TimeUnit unit)
                                   throws InterruptedException

      Throws:
        `InterruptedException`

    - #### execute

          public void execute(Runnable command)

    - #### handleException

          protected void handleException(Runnable task,
                             Exception e)

    - #### onRejectedExecution

          protected void onRejectedExecution(Runnable command)

      This method is invoked when all threads are busy and cannot accept command for immediate execution. This implementation executes the command in the caller thread.
      Parameters:
        `command` -

    - #### handleInterruptedException

          protected void handleInterruptedException(InterruptedException e)

    - #### newTaskFor

          protected <T> RunnableFuture<T> newTaskFor(Runnable runnable,
                                         T value)

      Overrides:
        `newTaskFor` in class `AbstractExecutorService`

    - #### newTaskFor

          protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable)

      Overrides:
        `newTaskFor` in class `AbstractExecutorService`