Package reactor.core.scheduler
Interface Scheduler.Worker
- All Superinterfaces:
Disposable
- Enclosing interface:
- Scheduler
A worker representing an asynchronous boundary that executes tasks.
- Author:
- Stephane Maldini, Simon Baslé
-
Nested Class Summary
Nested classes/interfaces inherited from interface reactor.core.Disposable
Disposable.Composite, Disposable.Swap -
Method Summary
Modifier and TypeMethodDescriptionSchedules the task for immediate execution on this worker.default DisposableSchedules the execution of the given task with the given delay amount.default DisposableschedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit) Schedules a periodic execution of the given task with the given initial delay and period.Methods inherited from interface reactor.core.Disposable
dispose, isDisposed
-
Method Details
-
schedule
Schedules the task for immediate execution on this worker.- Parameters:
task- the task to schedule- Returns:
- the
Disposableinstance that lets one cancel this particular task. If the Scheduler has been shut down, aRejectedExecutionExceptionis thrown.
-
schedule
Schedules the execution of the given task with the given delay amount.This method is safe to be called from multiple threads and tasks are executed in some total order. Two tasks scheduled at the same time with the same delay will be ordered in FIFO order if the schedule() was called from the same thread or in arbitrary order if the schedule() was called from different threads.
- Parameters:
task- the task to scheduledelay- the delay amount, non-positive values indicate non-delayed schedulingunit- the unit of measure of the delay amount- Returns:
- the
Disposablethat lets one cancel this particular delayed task, or throw aRejectedExecutionExceptionif the Worker is not capable of scheduling with delay.
-
schedulePeriodically
default Disposable schedulePeriodically(Runnable task, long initialDelay, long period, TimeUnit unit) Schedules a periodic execution of the given task with the given initial delay and period.This method is safe to be called from multiple threads.
The periodic execution is at a fixed rate, that is, the first execution will be after the initial delay, the second after initialDelay + period, the third after initialDelay + 2 * period, and so on.
- Parameters:
task- the task to scheduleinitialDelay- the initial delay amount, non-positive values indicate non-delayed schedulingperiod- the period at which the task should be re-executedunit- the unit of measure of the delay amount- Returns:
- the
Disposablethat lets one cancel this particular delayed task, or throw aRejectedExecutionExceptionif the Worker is not capable of scheduling periodically.
-