public final class SharedScheduler extends Scheduler
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 once shutdown()
it can't be revived.
Scheduler.Worker
Constructor and Description |
---|
SharedScheduler(Scheduler.Worker worker)
Constructs a SharedScheduler and uses the Worker instance provided.
|
SharedScheduler(Scheduler other)
Constructs a SharedScheduler and asks for a Worker from the provided other Scheduler.
|
Modifier and Type | Method and Description |
---|---|
Scheduler.Worker |
createWorker() |
long |
now(TimeUnit unit) |
Disposable |
scheduleDirect(Runnable run) |
Disposable |
scheduleDirect(Runnable run,
long delay,
TimeUnit unit) |
Disposable |
schedulePeriodicallyDirect(Runnable run,
long initialDelay,
long period,
TimeUnit unit) |
void |
shutdown() |
clockDriftTolerance, start, when
public SharedScheduler(Scheduler other)
other
- the other Scheduler instance, not nullpublic SharedScheduler(Scheduler.Worker worker)
worker
- the worker to use, not nullpublic Disposable scheduleDirect(Runnable run)
scheduleDirect
in class Scheduler
public Disposable scheduleDirect(Runnable run, long delay, TimeUnit unit)
scheduleDirect
in class Scheduler
public Disposable schedulePeriodicallyDirect(Runnable run, long initialDelay, long period, TimeUnit unit)
schedulePeriodicallyDirect
in class Scheduler
public Scheduler.Worker createWorker()
createWorker
in class Scheduler