Class TrampolineScheduler
- java.lang.Object
-
- io.reactivex.rxjava3.core.Scheduler
-
- io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler
-
public final class TrampolineScheduler extends Scheduler
Schedules work on the current thread but does not execute immediately. Work is put in a queue and executed after the current unit of work is completed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classTrampolineScheduler.SleepingRunnable(package private) static classTrampolineScheduler.TimedRunnable(package private) static classTrampolineScheduler.TrampolineWorker-
Nested classes/interfaces inherited from class io.reactivex.rxjava3.core.Scheduler
Scheduler.Worker
-
-
Field Summary
Fields Modifier and Type Field Description private static TrampolineSchedulerINSTANCE
-
Constructor Summary
Constructors Constructor Description TrampolineScheduler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @NonNull Scheduler.WorkercreateWorker()Retrieves or creates a newScheduler.Workerthat represents sequential execution of actions.static TrampolineSchedulerinstance()@NonNull DisposablescheduleDirect(@NonNull java.lang.Runnable run)Schedules the given task on this Scheduler without any time delay.@NonNull DisposablescheduleDirect(@NonNull java.lang.Runnable run, long delay, java.util.concurrent.TimeUnit unit)Schedules the execution of the given task with the given time delay.-
Methods inherited from class io.reactivex.rxjava3.core.Scheduler
clockDriftTolerance, now, schedulePeriodicallyDirect, shutdown, start, when
-
-
-
-
Field Detail
-
INSTANCE
private static final TrampolineScheduler INSTANCE
-
-
Method Detail
-
instance
public static TrampolineScheduler instance()
-
createWorker
@NonNull public @NonNull Scheduler.Worker 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
-
scheduleDirect
@NonNull public @NonNull Disposable scheduleDirect(@NonNull @NonNull java.lang.Runnable run)
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 java.lang.Runnable run, long delay, java.util.concurrent.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.
-
-