Note that this doesn't support recursive scheduling and disposing the returned Disposable has no effect (because when the schedule() method returns, the task has been already run).
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Disposable | |
| public static final Scheduler | INSTANCE
The singleton instance of the immediate (thin) scheduler. |
| pack-priv static final Scheduler. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Scheduler. | createWorker()
Implements abstract io. Scheduler. that represents sequential execution of actions.
|
| public Disposable | scheduleDirect(Runnable
the task to execute run)Overrides io. |
| public Disposable | scheduleDirect(Runnable
the task to schedule run, long the delay amount, non-positive values indicate non-delayed scheduling delay, TimeUnit the unit of measure of the delay amount unit)Overrides io. |
| public Disposable | schedulePeriodicallyDirect(Runnable
the task to schedule run, long the initial delay amount, non-positive values indicate non-delayed scheduling initialDelay, long the period at which the task should be re-executed period, TimeUnit the unit of measure of the delay amount unit)Overrides io. |
| DISPOSED | back to summary |
|---|---|
| pack-priv static final Disposable DISPOSED | |
| INSTANCE | back to summary |
|---|---|
| public static final Scheduler INSTANCE The singleton instance of the immediate (thin) scheduler. | |
| WORKER | back to summary |
|---|---|
| pack-priv static final Scheduler. | |
| ImmediateThinScheduler | back to summary |
|---|---|
| private ImmediateThinScheduler() | |
| createWorker | back to summary |
|---|---|
| public Scheduler. Implements abstract io. Doc from io. Retrieves or creates a new
When work is completed, the
Work on a | |
| scheduleDirect | back to summary |
|---|---|
| public Disposable scheduleDirect(Runnable run) Overrides io. Doc from io. Schedules the given task on this Scheduler without any time delay. This method is safe to be called from multiple threads but there are no ordering or non-overlapping guarantees between tasks.
| |
| scheduleDirect | back to summary |
|---|---|
| public Disposable scheduleDirect(Runnable run, long delay, TimeUnit unit) Overrides io. Doc from io. Schedules the execution of the given task with the given time delay. This method is safe to be called from multiple threads but there are no ordering guarantees between tasks.
| |
| schedulePeriodicallyDirect | back to summary |
|---|---|
| public Disposable schedulePeriodicallyDirect(Runnable run, long initialDelay, long period, TimeUnit unit) Overrides io. Doc from io. Schedules a periodic execution of the given task with the given initial time delay and repeat period. This method is safe to be called from multiple threads but there are no ordering guarantees between tasks.
The periodic execution is at a fixed rate, that is, the first execution will be after the
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Implements io. |
| public boolean | isDisposed()
Implements io. |
| public Disposable | schedule(Runnable
Runnable to schedule run)Overrides io. |
| public Disposable | schedule(Runnable
the Runnable to schedule run, long time to "wait" before executing the action; non-positive values indicate an non-delayed
schedule delay, TimeUnit the time unit of unit)delayTimeImplements abstract io. |
| public Disposable | schedulePeriodically(Runnable
the Runnable to execute periodically run, long time to wait before executing the action for the first time; non-positive values indicate
an non-delayed schedule initialDelay, long the time interval to wait each time in between executing the action; non-positive values
indicate no delay between repeated schedules period, TimeUnit the time unit of unit)periodOverrides io. |
| ImmediateThinWorker | back to summary |
|---|---|
| pack-priv ImmediateThinWorker() | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements io. Doc from io. Dispose the resource, the operation should be idempotent.
| |
| isDisposed | back to summary |
|---|---|
| public boolean isDisposed() Implements io. Doc from io. Returns true if this resource has been disposed.
| |
| schedule | back to summary |
|---|---|
| public Disposable schedule(Runnable run) Overrides io. Doc from io. Schedules a Runnable for execution without any time delay. The default implementation delegates to
| |
| schedule | back to summary |
|---|---|
| public Disposable schedule(Runnable run, long delay, TimeUnit unit) Implements abstract io. Doc from io. Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.
Note to implementors: non-positive
| |
| schedulePeriodically | back to summary |
|---|---|
| public Disposable schedulePeriodically(Runnable run, long initialDelay, long period, TimeUnit unit) Overrides io. Doc from io. Schedules a periodic execution of the given task with the given initial time delay and repeat period.
The default implementation schedules and reschedules the
Note to implementors: non-positive
| |