Class ImmediateThinScheduler.ImmediateThinWorker
- All Implemented Interfaces:
Disposable
- Enclosing class:
ImmediateThinScheduler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Dispose the resource, the operation should be idempotent.booleanReturns true if this resource has been disposed.Schedules a Runnable for execution without any time delay.Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.schedulePeriodically(@NonNull Runnable run, long initialDelay, long period, TimeUnit unit) Schedules a periodic execution of the given task with the given initial time delay and repeat period.Methods inherited from class Scheduler.Worker
now
-
Constructor Details
-
ImmediateThinWorker
ImmediateThinWorker()
-
-
Method Details
-
dispose
public void dispose()Description copied from interface:DisposableDispose the resource, the operation should be idempotent. -
isDisposed
public boolean isDisposed()Description copied from interface:DisposableReturns true if this resource has been disposed.- Returns:
- true if this resource has been disposed
-
schedule
Description copied from class:Scheduler.WorkerSchedules a Runnable for execution without any time delay.The default implementation delegates to
Scheduler.Worker.schedule(Runnable, long, TimeUnit).- Overrides:
schedulein classScheduler.Worker- Parameters:
run- Runnable to schedule- Returns:
- a Disposable to be able to unsubscribe the action (cancel it if not executed)
-
schedule
@NonNull public @NonNull Disposable schedule(@NonNull @NonNull Runnable run, long delay, @NonNull @NonNull TimeUnit unit) Description copied from class:Scheduler.WorkerSchedules 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
delayTimeshould be regarded as non-delayed schedule, i.e., as if theScheduler.Worker.schedule(Runnable)was called.- Specified by:
schedulein classScheduler.Worker- Parameters:
run- the Runnable to scheduledelay- time to "wait" before executing the action; non-positive values indicate an non-delayed scheduleunit- the time unit ofdelayTime- Returns:
- a Disposable to be able to unsubscribe the action (cancel it if not executed)
-
schedulePeriodically
@NonNull public @NonNull Disposable schedulePeriodically(@NonNull @NonNull Runnable run, long initialDelay, long period, TimeUnit unit) Description copied from class:Scheduler.WorkerSchedules a periodic execution of the given task with the given initial time delay and repeat period.The default implementation schedules and reschedules the
Runnabletask via theScheduler.Worker.schedule(Runnable, long, TimeUnit)method over and over and at a fixed rate, that is, the first execution will be after theinitialDelay, the second afterinitialDelay + period, the third afterinitialDelay + 2 * period, and so on.Note to implementors: non-positive
initialTimeandperiodshould be regarded as non-delayed scheduling of the first and any subsequent executions. In addition, a more specificWorkerimplementation should override this method if it can perform the periodic task execution with less overhead (such as by avoiding the creation of the wrapper and tracker objects upon each periodic invocation of the commonScheduler.Worker.schedule(Runnable, long, TimeUnit)method).- Overrides:
schedulePeriodicallyin classScheduler.Worker- Parameters:
run- the Runnable to execute periodicallyinitialDelay- time to wait before executing the action for the first time; non-positive values indicate an non-delayed scheduleperiod- the time interval to wait each time in between executing the action; non-positive values indicate no delay between repeated schedulesunit- the time unit ofperiod- Returns:
- a Disposable to be able to unsubscribe the action (cancel it if not executed)
-