Package picard.util

## Class ThreadPoolExecutorWithExceptions

- java.lang.Object
- - java.util.concurrent.AbstractExecutorService
  - - java.util.concurrent.ThreadPoolExecutor
    - - picard.util.ThreadPoolExecutorWithExceptions

- All Implemented Interfaces:
    `Executor`, `ExecutorService`

      public class ThreadPoolExecutorWithExceptions
      extends ThreadPoolExecutor

  This version of the thread pool executor will throw an exception if any of the internal jobs have throw exceptions while executing

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor

      `ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `Throwable` | `exception` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ThreadPoolExecutorWithExceptions​(int threads)` | Creates a fixed size thread pool executor that will rethrow exceptions from submitted jobs.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `afterExecute​(Runnable r, Throwable t)` |
    `protected void` | `beforeExecute​(Thread t, Runnable r)` |
    `void` | `cleanUp()` | Calls `shutdownNow, adjusts the core size to 0 and low timeout to ensure threads get killed and garbage collected.
    `boolean` | `hasError()` |

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

      `allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString`

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

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

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

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

- - ### Field Detail

    - #### exception

          public Throwable exception

  - ### Constructor Detail

    - #### ThreadPoolExecutorWithExceptions

          public ThreadPoolExecutorWithExceptions​(int threads)

      Creates a fixed size thread pool executor that will rethrow exceptions from submitted jobs.
      Parameters:
        `threads` - The number of threads in the executor pool.

  - ### Method Detail

    - #### afterExecute

          protected void afterExecute​(Runnable r,
                                      Throwable t)

      Overrides:
        `afterExecute` in class `ThreadPoolExecutor`

    - #### beforeExecute

          protected void beforeExecute​(Thread t,
                                       Runnable r)

      Overrides:
        `beforeExecute` in class `ThreadPoolExecutor`

    - #### hasError

          public boolean hasError()

    - #### cleanUp

          public void cleanUp()

      Calls `shutdownNow, adjusts the core size to 0 and low timeout to ensure threads get killed and garbage collected.