Class ScheduledTaskThreadPool
java.lang.Object
ca.spottedleaf.concurrentutil.scheduler.ScheduledTaskThreadPool
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a tickable task that can be scheduled into aScheduledTaskThreadPool. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnsfalseif the task is not scheduled or is cancelled, returnstrueif the task was cancelled by this threadvoidhalt()Attempts to prevent further execution of tasks.booleanjoin(long msToWait) Waits until all threads in this pool have shutdown, or until the specified time has passed.booleanjoinInterruptable(long msToWait) Waits until all threads in this pool have shutdown, or until the specified time has passed.voidIndicates that intermediate tasks are available to be executed by the task.voidSchedules the specified task to be executed on this thread pool.
-
Field Details
-
DEADLINE_NOT_SET
public static final long DEADLINE_NOT_SET- See Also:
-
-
Constructor Details
-
ScheduledTaskThreadPool
-
-
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:
falseif the maximum time passed,trueotherwise.
-
joinInterruptable
Waits until all threads in this pool have shutdown, or until the specified time has passed.- Parameters:
msToWait- Maximum time to wait.- Returns:
falseif the maximum time passed,trueotherwise.- Throws:
InterruptedException- If this thread is interrupted.
-
schedule
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
Indicates that intermediate tasks are available to be executed by the task.- Parameters:
tick- The specified task- See Also:
-
cancel
Returnsfalseif the task is not scheduled or is cancelled, returnstrueif the task was cancelled by this thread
-