Class ScheduledTaskThreadPool

java.lang.Object
ca.spottedleaf.concurrentutil.scheduler.ScheduledTaskThreadPool

public final class ScheduledTaskThreadPool extends Object
  • Field Details

  • Constructor Details

    • ScheduledTaskThreadPool

      public ScheduledTaskThreadPool(ThreadFactory threadFactory)
  • Method Details

    • halt

      public void halt()
      Attempts to prevent further execution of tasks.
    • 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.
    • schedule

      public void schedule(ScheduledTaskThreadPool.SchedulableTick tick)
      Schedules the specified task to be executed on this thread pool.
      Parameters:
      tick - Specified task
      Throws:
      IllegalStateException - If the task is already scheduled
      See Also:
    • notifyTasks

      public void notifyTasks(ScheduledTaskThreadPool.SchedulableTick tick)
      Indicates that intermediate tasks are available to be executed by the task.
      Parameters:
      tick - The specified task
      See Also:
    • cancel

      public boolean cancel(ScheduledTaskThreadPool.SchedulableTick tick)
      Returns false if the task is not scheduled or is cancelled, returns true if the task was cancelled by this thread