Class ThreadPool

java.lang.Object
io.fusionauth.http.util.ThreadPool

public class ThreadPool extends Object
Technically, this is a delegate to the thread pool, but close enough. It uses an ExecutorService to submit work to be processed.

This should be used in a singleton fashion, but it is not a singleton (yuck).

Author:
Brian Pontarelli
  • Constructor Details

    • ThreadPool

      public ThreadPool(int numberOfThreads, String namePrefix, Duration shutdown)
      Constructs a ThreadPool with the given number of threads, thread name prefix, and shutdown duration. All the threads are started immediately and are core system threads (not the new Java light threads). The shutdown duration is the time that the thread that calls shutdown() will wait for an orderly shutdown of the pool, meaning that the threads will be finished working.
      Parameters:
      numberOfThreads - The number of threads. All the
      namePrefix - The name prefix for the worker threads.
      shutdown - The shutdown duration.
  • Method Details

    • shutdown

      public boolean shutdown()
    • submit

      public Future<?> submit(Runnable runnable)