de.caff.util.concurrent

## Class Exec.FinishingThreadPoolExecutor

- java.lang.Object
- - de.caff.util.concurrent.Exec.FinishingThreadPoolExecutor

- All Implemented Interfaces:
    java.util.concurrent.Executor, java.util.concurrent.ExecutorService
  Enclosing class:
    Exec

      public static class Exec.FinishingThreadPoolExecutor
      extends java.lang.Object
      implements java.util.concurrent.ExecutorService

  This is a wrapper for a thread-pool executor which accepts runnable tasks and can wait until all of them are finished.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FinishingThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor executor)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)`
    `void` | `execute(java.lang.Runnable command)`
    `<T> java.util.List<java.util.concurrent.Future<T>>` | `invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)`
    `<T> java.util.List<java.util.concurrent.Future<T>>` | `invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)`
    `<T> T` | `invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)`
    `<T> T` | `invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks, long timeout, java.util.concurrent.TimeUnit unit)`
    `boolean` | `isShutdown()`
    `boolean` | `isTerminated()`
    `void` | `shutdown()`
    `java.util.List<java.lang.Runnable>` | `shutdownNow()`
    `<T> java.util.concurrent.Future<T>` | `submit(java.util.concurrent.Callable<T> task)`
    `java.util.concurrent.Future<?>` | `submit(java.lang.Runnable task)`
    `<T> java.util.concurrent.Future<T>` | `submit(java.lang.Runnable task, T result)`
    `void` | `waitUntilFinished()` Wait until this executor is finished.

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

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

- - ### Constructor Detail

    - #### FinishingThreadPoolExecutor

          public FinishingThreadPoolExecutor(@NotNull
                                             java.util.concurrent.ThreadPoolExecutor executor)

      Constructor.
      Parameters:
        `executor` - wrapped executor

  - ### Method Detail

    - #### execute

          public void execute(@NotNull
                              java.lang.Runnable command)

      Specified by:
        `execute` in interface `java.util.concurrent.Executor`

    - #### shutdown

          public void shutdown()

      Specified by:
        `shutdown` in interface `java.util.concurrent.ExecutorService`

    - #### shutdownNow

          @NotNull
          public java.util.List<java.lang.Runnable> shutdownNow()

      Specified by:
        `shutdownNow` in interface `java.util.concurrent.ExecutorService`

    - #### isShutdown

          public boolean isShutdown()

      Specified by:
        `isShutdown` in interface `java.util.concurrent.ExecutorService`

    - #### isTerminated

          public boolean isTerminated()

      Specified by:
        `isTerminated` in interface `java.util.concurrent.ExecutorService`

    - #### awaitTermination

          public boolean awaitTermination(long timeout,
                                          @NotNull
                                          java.util.concurrent.TimeUnit unit)
                                   throws java.lang.InterruptedException

      Specified by:
        `awaitTermination` in interface `java.util.concurrent.ExecutorService`
      Throws:
        `java.lang.InterruptedException`

    - #### submit

          @NotNull
          public java.util.concurrent.Future<?> submit(@NotNull
                                                                java.lang.Runnable task)

      Specified by:
        `submit` in interface `java.util.concurrent.ExecutorService`

    - #### submit

          @NotNull
          public <T> java.util.concurrent.Future<T> submit(@NotNull
                                                                    java.util.concurrent.Callable<T> task)

      Specified by:
        `submit` in interface `java.util.concurrent.ExecutorService`

    - #### submit

          @NotNull
          public <T> java.util.concurrent.Future<T> submit(@NotNull
                                                                    java.lang.Runnable task,
                                                                    T result)

      Specified by:
        `submit` in interface `java.util.concurrent.ExecutorService`

    - #### invokeAll

          @NotNull
          public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(@NotNull
                                                                                       java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                                                                                throws java.lang.InterruptedException

      Specified by:
        `invokeAll` in interface `java.util.concurrent.ExecutorService`
      Throws:
        `java.lang.InterruptedException`

    - #### invokeAll

          @NotNull
          public <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(@NotNull
                                                                                       java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
                                                                                       long timeout,
                                                                                       @NotNull
                                                                                       java.util.concurrent.TimeUnit unit)
                                                                                throws java.lang.InterruptedException

      Specified by:
        `invokeAll` in interface `java.util.concurrent.ExecutorService`
      Throws:
        `java.lang.InterruptedException`

    - #### invokeAny

          @NotNull
          public <T> T invokeAny(@NotNull
                                          java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
                                   throws java.lang.InterruptedException,
                                          java.util.concurrent.ExecutionException

      Specified by:
        `invokeAny` in interface `java.util.concurrent.ExecutorService`
      Throws:
        `java.lang.InterruptedException`
        `java.util.concurrent.ExecutionException`

    - #### invokeAny

          public <T> T invokeAny(@NotNull
                                 java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
                                 long timeout,
                                 @NotNull
                                 java.util.concurrent.TimeUnit unit)
                          throws java.lang.InterruptedException,
                                 java.util.concurrent.ExecutionException,
                                 java.util.concurrent.TimeoutException

      Specified by:
        `invokeAny` in interface `java.util.concurrent.ExecutorService`
      Throws:
        `java.lang.InterruptedException`
        `java.util.concurrent.ExecutionException`
        `java.util.concurrent.TimeoutException`

    - #### waitUntilFinished

          public void waitUntilFinished()
                                 throws java.util.concurrent.ExecutionException,
                                        java.lang.InterruptedException

      Wait until this executor is finished.
      Throws:
        `java.util.concurrent.ExecutionException` - wrapped exception from one of the tasks
        `java.lang.InterruptedException` - if this executor was interrupted