Package io.fusionauth.http.util
Class ThreadPool
java.lang.Object
io.fusionauth.http.util.ThreadPool
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 Summary
ConstructorsConstructorDescriptionThreadPool(int numberOfThreads, String namePrefix, Duration shutdown) Constructs a ThreadPool with the given number of threads, thread name prefix, and shutdown duration. -
Method Summary
-
Constructor Details
-
ThreadPool
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 callsshutdown()will wait for an orderly shutdown of the pool, meaning that the threads will be finished working.- Parameters:
numberOfThreads- The number of threads. All thenamePrefix- The name prefix for the worker threads.shutdown- The shutdown duration.
-
-
Method Details
-
shutdown
public boolean shutdown() -
submit
-