Class ThreadPoolManager

java.lang.Object
io.github.connellite.concurrent.ThreadPoolManager

public class ThreadPoolManager extends Object
  • 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

      public ThreadPoolManager(int nThreads, String name)
      Create new thread pool manage.
      Parameters:
      nThreads - Number of concurrent threads.
      name - Name of the thread pool.
  • Method Details

    • add

      public void add(Runnable runnable)
      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.