Class ImmediateThinScheduler
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).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classNested classes/interfaces inherited from class io.reactivex.rxjava3.core.Scheduler
Scheduler.Worker -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Disposablestatic final SchedulerThe singleton instance of the immediate (thin) scheduler.(package private) static final Scheduler.Worker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves or creates a newScheduler.Workerthat represents sequential execution of actions.Schedules the given task on this Scheduler without any time delay.scheduleDirect(@NonNull Runnable run, long delay, TimeUnit unit) Schedules the execution of the given task with the given time delay.schedulePeriodicallyDirect(@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.
-
Field Details
-
INSTANCE
The singleton instance of the immediate (thin) scheduler. -
WORKER
-
DISPOSED
-
-
Constructor Details
-
ImmediateThinScheduler
private ImmediateThinScheduler()
-
-
Method Details
-
scheduleDirect
Description copied from class:SchedulerSchedules 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.
- Overrides:
scheduleDirectin classScheduler- Parameters:
run- the task to execute- Returns:
- the Disposable instance that let's one cancel this particular task.
-
scheduleDirect
@NonNull public @NonNull Disposable scheduleDirect(@NonNull @NonNull Runnable run, long delay, TimeUnit unit) Description copied from class:SchedulerSchedules 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.
- Overrides:
scheduleDirectin classScheduler- Parameters:
run- the task to scheduledelay- the delay amount, non-positive values indicate non-delayed schedulingunit- the unit of measure of the delay amount- Returns:
- the Disposable that let's one cancel this particular delayed task.
-
schedulePeriodicallyDirect
@NonNull public @NonNull Disposable schedulePeriodicallyDirect(@NonNull @NonNull Runnable run, long initialDelay, long period, TimeUnit unit) Description copied from class:SchedulerSchedules 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
initialDelay, the second afterinitialDelay + period, the third afterinitialDelay + 2 * period, and so on.- Overrides:
schedulePeriodicallyDirectin classScheduler- Parameters:
run- 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 Disposable that let's one cancel this particular delayed task.
-
createWorker
Description copied from class:SchedulerRetrieves or creates a newScheduler.Workerthat represents sequential execution of actions.When work is completed, the
Workerinstance should be released by callingDisposable.dispose()to avoid potential resource leaks in the underlying task-execution scheme.Work on a
Scheduler.Workeris guaranteed to be sequential and non-overlapping.- Specified by:
createWorkerin classScheduler- Returns:
- a Worker representing a serial queue of actions to be executed
-