Class TrampolineScheduler.TrampolineWorker
- java.lang.Object
-
- io.reactivex.rxjava3.core.Scheduler.Worker
-
- io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler.TrampolineWorker
-
- All Implemented Interfaces:
Disposable
- Enclosing class:
- TrampolineScheduler
static final class TrampolineScheduler.TrampolineWorker extends Scheduler.Worker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classTrampolineScheduler.TrampolineWorker.AppendToQueueTask
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.concurrent.atomic.AtomicIntegercounter(package private) booleandisposed(package private) java.util.concurrent.PriorityBlockingQueue<TrampolineScheduler.TimedRunnable>queueprivate java.util.concurrent.atomic.AtomicIntegerwip
-
Constructor Summary
Constructors Constructor Description TrampolineWorker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Dispose the resource, the operation should be idempotent.(package private) Disposableenqueue(java.lang.Runnable action, long execTime)booleanisDisposed()Returns true if this resource has been disposed.@NonNull Disposableschedule(@NonNull java.lang.Runnable action)Schedules a Runnable for execution without any time delay.@NonNull Disposableschedule(@NonNull java.lang.Runnable action, long delayTime, @NonNull java.util.concurrent.TimeUnit unit)Schedules an Runnable for execution at some point in the future specified by a time delay relative to the current time.-
Methods inherited from class io.reactivex.rxjava3.core.Scheduler.Worker
now, schedulePeriodically
-
-
-
-
Field Detail
-
queue
final java.util.concurrent.PriorityBlockingQueue<TrampolineScheduler.TimedRunnable> queue
-
wip
private final java.util.concurrent.atomic.AtomicInteger wip
-
counter
final java.util.concurrent.atomic.AtomicInteger counter
-
disposed
volatile boolean disposed
-
-
Method Detail
-
schedule
@NonNull public @NonNull Disposable schedule(@NonNull @NonNull java.lang.Runnable action)
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:
action- 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 java.lang.Runnable action, long delayTime, @NonNull @NonNull java.util.concurrent.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:
action- the Runnable to scheduledelayTime- 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)
-
enqueue
Disposable enqueue(java.lang.Runnable action, long execTime)
-
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
-
-