T
- Actor type to schedule referencing work.public interface ActionScheduler<T>
Executor
. Action
can be scheduled to be run once
now, in the future and periodically at an interval. When an action is run work can be performed
using a supplied actor, scheduler defines the actor type as well as a means to maintain
previously scheduled/running actions.Modifier and Type | Method and Description |
---|---|
void |
cancelAllScheduledForActor()
Cancels all tasks currently running/scheduled (scheduled by this).
|
SchedulableActionContext<T> |
newContextForActor(Action<T> action)
Creates a new mutable context for the supplied action and this actor.
|
default ActionContext<T> |
scheduleForActor(Action<T> action)
Schedules an action for immediate execution.
|
ActionContext<T> |
scheduleForActor(Action<T> action,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit)
Schedules an action for execution with a supplied initial delay and repeat period.
|
default ActionContext<T> |
scheduleForActor(Action<T> action,
long initialDelay,
java.util.concurrent.TimeUnit unit)
Schedules an action to be executed after the supplied delay.
|
void cancelAllScheduledForActor()
SchedulableActionContext<T> newContextForActor(Action<T> action)
action
- Action to create context for.default ActionContext<T> scheduleForActor(Action<T> action)
action
- Action to schedule.ActionContext<T> scheduleForActor(Action<T> action, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
action
- Action to schedule.initialDelay
- Initial delay before schedule (can be 0
).period
- Period for repeating (can be 0
).unit
- Time unit of initial delay and period.default ActionContext<T> scheduleForActor(Action<T> action, long initialDelay, java.util.concurrent.TimeUnit unit)
action
- Action to schedule.initialDelay
- Delay before schedule.unit
- TimeUnit of the delay.