Interface ScheduledTask
public interface ScheduledTask
Represents a task scheduled to a scheduler.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
Represents the result of attempting to cancel a task.static enum
Represents the current execution state of the task. -
Method Summary
Modifier and TypeMethodDescriptioncancel()
Attempts to cancel this task, returning the result of the attempt.Returns the current execution state of this task.Returns the plugin that scheduled this task.default boolean
Returns whether the current execution state isScheduledTask.ExecutionState.CANCELLED
orScheduledTask.ExecutionState.CANCELLED_RUNNING
.boolean
Returns whether this task executes on a fixed period, as opposed to executing only once.
-
Method Details
-
getOwningPlugin
Returns the plugin that scheduled this task.- Returns:
- the plugin that scheduled this task.
-
isRepeatingTask
boolean isRepeatingTask()Returns whether this task executes on a fixed period, as opposed to executing only once.- Returns:
- whether this task executes on a fixed period, as opposed to executing only once.
-
cancel
Attempts to cancel this task, returning the result of the attempt. In all cases, if the task is currently being executed no attempt is made to halt the task, however any executions in the future are halted.- Returns:
- the result of the cancellation attempt.
-
getExecutionState
Returns the current execution state of this task.- Returns:
- the current execution state of this task.
-
isCancelled
default boolean isCancelled()Returns whether the current execution state isScheduledTask.ExecutionState.CANCELLED
orScheduledTask.ExecutionState.CANCELLED_RUNNING
.- Returns:
- whether the current execution state is
ScheduledTask.ExecutionState.CANCELLED
orScheduledTask.ExecutionState.CANCELLED_RUNNING
.
-