Package hu.akarnokd.rxjava3.schedulers
Class SharedScheduler
- java.lang.Object
-
- io.reactivex.rxjava3.core.Scheduler
-
- hu.akarnokd.rxjava3.schedulers.SharedScheduler
-
public final class SharedScheduler extends Scheduler
A Scheduler implementation that uses one of the Workers from another Scheduler and shares the access to it through its own Workers.Disposing a worker doesn't dispose the underlying shared worker so other workers of this class can continue their work; use
shutdown()to release the underlying shared worker.This scheduler doesn't support
Scheduler.start()(it's a no-op) and onceshutdown()it can't be revived.- Since:
- 0.6.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.reactivex.rxjava3.core.Scheduler
Scheduler.Worker
-
-
Constructor Summary
Constructors Constructor Description SharedScheduler(Scheduler other)Constructs a SharedScheduler and asks for a Worker from the provided other Scheduler.SharedScheduler(Scheduler.Worker worker)Constructs a SharedScheduler and uses the Worker instance provided.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Scheduler.WorkercreateWorker()longnow(java.util.concurrent.TimeUnit unit)DisposablescheduleDirect(java.lang.Runnable run)DisposablescheduleDirect(java.lang.Runnable run, long delay, java.util.concurrent.TimeUnit unit)DisposableschedulePeriodicallyDirect(java.lang.Runnable run, long initialDelay, long period, java.util.concurrent.TimeUnit unit)voidshutdown()-
Methods inherited from class io.reactivex.rxjava3.core.Scheduler
clockDriftTolerance, start, when
-
-
-
-
Constructor Detail
-
SharedScheduler
public SharedScheduler(Scheduler other)
Constructs a SharedScheduler and asks for a Worker from the provided other Scheduler.- Parameters:
other- the other Scheduler instance, not null
-
SharedScheduler
public SharedScheduler(Scheduler.Worker worker)
Constructs a SharedScheduler and uses the Worker instance provided.- Parameters:
worker- the worker to use, not null
-
-
Method Detail
-
scheduleDirect
public Disposable scheduleDirect(java.lang.Runnable run)
- Overrides:
scheduleDirectin classScheduler
-
scheduleDirect
public Disposable scheduleDirect(java.lang.Runnable run, long delay, java.util.concurrent.TimeUnit unit)
- Overrides:
scheduleDirectin classScheduler
-
schedulePeriodicallyDirect
public Disposable schedulePeriodicallyDirect(java.lang.Runnable run, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
- Overrides:
schedulePeriodicallyDirectin classScheduler
-
createWorker
public Scheduler.Worker createWorker()
- Specified by:
createWorkerin classScheduler
-
-