Top Description Inners Fields Constructors Methods
io.reactivex.rxjava3.internal.schedulers

public final Class TrampolineScheduler

extends Scheduler
Class Inheritance
Imports
java.util.concurrent.*, java.util.concurrent.atomic.AtomicInteger, io.reactivex.rxjava3.annotations.NonNull, io.reactivex.rxjava3.core.Scheduler, io.reactivex.rxjava3.disposables.*, io.reactivex.rxjava3.internal.disposables.EmptyDisposable, io.reactivex.rxjava3.plugins.RxJavaPlugins

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 and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final TrampolineScheduler

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public @NonNull Scheduler.Worker
createWorker()

Implements abstract io.reactivex.rxjava3.core.Scheduler.createWorker.

Retrieves or creates a new Scheduler.Worker that represents sequential execution of actions.
public static TrampolineScheduler
public @NonNull Disposable
public @NonNull Disposable
scheduleDirect(@NonNull Runnable run, long delay, TimeUnit unit)

Inherited from io.reactivex.rxjava3.core.Scheduler:
clockDriftTolerancenowscheduleDirectscheduleDirectschedulePeriodicallyDirectshutdownstartwhen

Field Detail

INSTANCEback to summary
private static final TrampolineScheduler INSTANCE

Constructor Detail

TrampolineSchedulerback to summary
pack-priv TrampolineScheduler()

Method Detail

createWorkerback to summary
public @NonNull Scheduler.Worker createWorker()

Implements abstract io.reactivex.rxjava3.core.Scheduler.createWorker.

Doc from io.reactivex.rxjava3.core.Scheduler.createWorker.

Retrieves or creates a new Scheduler.Worker that represents sequential execution of actions.

When work is completed, the Worker instance should be released by calling Scheduler.Worker#dispose() to avoid potential resource leaks in the underlying task-execution scheme.

Work on a Scheduler.Worker is guaranteed to be sequential and non-overlapping.

Returns:@NonNull Scheduler.Worker

a Worker representing a serial queue of actions to be executed

Annotations
@NonNull
@Override
instanceback to summary
public static TrampolineScheduler instance()
scheduleDirectback to summary
public @NonNull Disposable scheduleDirect(@NonNull Runnable run)
Annotations
@NonNull
@Override
scheduleDirectback to summary
public @NonNull Disposable scheduleDirect(@NonNull Runnable run, long delay, TimeUnit unit)
Annotations
@NonNull
@Override
io.reactivex.rxjava3.internal.schedulers back to summary

pack-priv final Class TrampolineScheduler.SleepingRunnable

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler.SleepingRunnable
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final long
private final Runnable
private final TrampolineScheduler.TrampolineWorker

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

execTimeback to summary
private final long execTime
runback to summary
private final Runnable run
workerback to summary
private final TrampolineScheduler.TrampolineWorker worker

Constructor Detail

SleepingRunnableback to summary
pack-priv SleepingRunnable(Runnable run, TrampolineScheduler.TrampolineWorker worker, long execTime)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override
io.reactivex.rxjava3.internal.schedulers back to summary

pack-priv final Class TrampolineScheduler.TimedRunnable

extends Object
implements Comparable<TrampolineScheduler.TimedRunnable>
Class Inheritance
  • java.lang.Object
  • io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler.TimedRunnable
All Implemented Interfaces
java.lang.Comparable

Field Summary

Modifier and TypeField and Description
pack-priv final int
pack-priv volatile boolean
pack-priv final long
pack-priv final Runnable

Constructor Summary

AccessConstructor and Description
pack-priv
TimedRunnable(Runnable run, Long execTime, int count)

Method Summary

Modifier and TypeMethod and Description
public int
compareTo(TrampolineScheduler.TimedRunnable
the object to be compared.
that
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

countback to summary
pack-priv final int count
disposedback to summary
pack-priv volatile boolean disposed
execTimeback to summary
pack-priv final long execTime
runback to summary
pack-priv final Runnable run

Constructor Detail

TimedRunnableback to summary
pack-priv TimedRunnable(Runnable run, Long execTime, int count)

Method Detail

compareToback to summary
public int compareTo(TrampolineScheduler.TimedRunnable that)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Parameters
that:TrampolineScheduler.TimedRunnable

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
io.reactivex.rxjava3.internal.schedulers back to summary

pack-priv final Class TrampolineScheduler.TrampolineWorker

extends Worker
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class

Field Summary

Modifier and TypeField and Description
pack-priv final AtomicInteger
pack-priv volatile boolean
pack-priv final PriorityBlockingQueue<TrampolineScheduler.TimedRunnable>
private final AtomicInteger

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
pack-priv Disposable
enqueue(Runnable action, long execTime)

public boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public @NonNull Disposable
public @NonNull Disposable
schedule(@NonNull Runnable action, long delayTime, @NonNull TimeUnit unit)

Inherited from io.reactivex.rxjava3.core.Scheduler.Worker:
nowschedulescheduleschedulePeriodically

Field Detail

counterback to summary
pack-priv final AtomicInteger counter
disposedback to summary
pack-priv volatile boolean disposed
queueback to summary
pack-priv final PriorityBlockingQueue<TrampolineScheduler.TimedRunnable> queue
wipback to summary
private final AtomicInteger wip

Constructor Detail

TrampolineWorkerback to summary
pack-priv TrampolineWorker()

Method Detail

disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
enqueueback to summary
pack-priv Disposable enqueue(Runnable action, long execTime)
isDisposedback to summary
public boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
scheduleback to summary
public @NonNull Disposable schedule(@NonNull Runnable action)
Annotations
@NonNull
@Override
scheduleback to summary
public @NonNull Disposable schedule(@NonNull Runnable action, long delayTime, @NonNull TimeUnit unit)
Annotations
@NonNull
@Override
io.reactivex.rxjava3.internal.schedulers back to summary

pack-priv final Class TrampolineScheduler.TrampolineWorker.AppendToQueueTask

extends Object
implements Runnable
Class Inheritance
  • java.lang.Object
  • io.reactivex.rxjava3.internal.schedulers.TrampolineScheduler.TrampolineWorker.AppendToQueueTask
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
pack-priv final TrampolineScheduler.TimedRunnable

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

timedRunnableback to summary
pack-priv final TrampolineScheduler.TimedRunnable timedRunnable

Constructor Detail

AppendToQueueTaskback to summary
pack-priv AppendToQueueTask(TrampolineScheduler.TimedRunnable timedRunnable)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override