Package arc.util
Class Timer.Task
java.lang.Object
arc.util.Timer.Task
- All Implemented Interfaces:
Runnable
- Enclosing class:
- Timer
Runnable that can be scheduled on a
Timer.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancels the task.longReturns the time in milliseconds when this task will be executed next.booleanReturns true if this task is scheduled to be executed in the future by a timer.voidReschelude this task in future.abstract voidrun()If this is the last time the task will be ran or the task is first cancelled, it may be scheduled again in this method.
-
Constructor Details
-
Task
public Task()
-
-
Method Details
-
run
public abstract void run()If this is the last time the task will be ran or the task is first cancelled, it may be scheduled again in this method. -
cancel
public void cancel()Cancels the task. It will not be executed until it is scheduled again. This method can be called at any time. -
reschedule
public void reschedule()Reschelude this task in future. Does nothing if task was previously canceled or finished. -
isScheduled
public boolean isScheduled()Returns true if this task is scheduled to be executed in the future by a timer. The execution time may be reached at any time after calling this method, which may change the scheduled state. To prevent the scheduled state from changing, synchronize on this task object, eg:synchronized (task) { if (!task.isScheduled()) { ... } } -
getExecuteTimeMillis
public long getExecuteTimeMillis()Returns the time in milliseconds when this task will be executed next.
-