Class PrioritisedThreadPool

java.lang.Object
ca.spottedleaf.concurrentutil.executor.thread.PrioritisedThreadPool

public final class PrioritisedThreadPool extends Object
  • Constructor Details

    • PrioritisedThreadPool

      public PrioritisedThreadPool(Consumer<Thread> threadModifier)
  • Method Details

    • getAliveThreads

      public Thread[] getAliveThreads()
    • getCoreThreads

      public Thread[] getCoreThreads()
    • halt

      public void halt(boolean shutdownQueues)
      Prevents creation of new queues, shutdowns all non-shutdown queues if specified
    • join

      public boolean join(long msToWait)
      Waits until all threads in this pool have shutdown, or until the specified time has passed.
      Parameters:
      msToWait - Maximum time to wait.
      Returns:
      false if the maximum time passed, true otherwise.
    • joinInterruptable

      public boolean joinInterruptable(long msToWait) throws InterruptedException
      Waits until all threads in this pool have shutdown, or until the specified time has passed.
      Parameters:
      msToWait - Maximum time to wait.
      Returns:
      false if the maximum time passed, true otherwise.
      Throws:
      InterruptedException - If this thread is interrupted.
    • join

      protected final boolean join(long msToWait, boolean interruptable) throws InterruptedException
      Throws:
      InterruptedException
    • shutdown

      public void shutdown(boolean wait)
      Shuts down this thread pool, optionally waiting for all tasks to be executed. This function will invoke PrioritisedExecutor.shutdown() on all created executors on this thread pool.
      Parameters:
      wait - Whether to wait for tasks to be executed
    • adjustThreadCount

      public void adjustThreadCount(int threads)
    • createExecutorGroup

      public PrioritisedThreadPool.ExecutorGroup createExecutorGroup(int division, int flags)