Package io.github.connellite.concurrent
Class ThreadPoolManager
java.lang.Object
io.github.connellite.concurrent.ThreadPoolManager
-
Constructor Summary
ConstructorsConstructorDescriptionCreate new thread pool manage.ThreadPoolManager(int nThreads) Create new thread pool manage.ThreadPoolManager(int nThreads, String name) Create new thread pool manage. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new thread to the manager.voidshutdown()Shutdown pool manager.voidshutdown(boolean now) Shutdown pool manager.static voidShutdown all created poll managers.static voidshutdownAll(boolean now) Shutdown all created poll managers.
-
Constructor Details
-
ThreadPoolManager
public ThreadPoolManager()Create new thread pool manage. -
ThreadPoolManager
public ThreadPoolManager(int nThreads) Create new thread pool manage.- Parameters:
nThreads- Number of concurrent threads.
-
ThreadPoolManager
Create new thread pool manage.- Parameters:
nThreads- Number of concurrent threads.name- Name of the thread pool.
-
-
Method Details
-
add
Add a new thread to the manager.- Parameters:
runnable- The Runnable task to add.
-
shutdown
public void shutdown()Shutdown pool manager. -
shutdown
public void shutdown(boolean now) Shutdown pool manager.- Parameters:
now- If the shutdown should be right now or can wait until all thread have finished.
-
shutdownAll
public static void shutdownAll()Shutdown all created poll managers. -
shutdownAll
public static void shutdownAll(boolean now) Shutdown all created poll managers.- Parameters:
now- If the shutdown should be right now or can wait until all thread have finished.
-