public abstract class Scheduler
extends java.lang.Object
Common implementations can be found in Schedulers
.
Why is this an abstract class instead of an interface?
Modifier and Type | Class and Description |
---|---|
static class |
Scheduler.Worker
Sequential Scheduler for executing actions on a single thread or event loop.
|
Constructor and Description |
---|
Scheduler() |
Modifier and Type | Method and Description |
---|---|
abstract Scheduler.Worker |
createWorker()
Retrieves or creates a new
Scheduler.Worker that represents serial execution of actions. |
long |
now()
Gets the current time, in milliseconds, according to this Scheduler.
|
int |
parallelism()
Indicates the parallelism available to this Scheduler.
|
public abstract Scheduler.Worker createWorker()
Scheduler.Worker
that represents serial execution of actions.
When work is completed it should be unsubscribed using Subscription.unsubscribe()
.
Work on a Scheduler.Worker
is guaranteed to be sequential.
public int parallelism()
This defaults to Runtime.getRuntime().availableProcessors()
but can be overridden for use cases
such as scheduling work on a computer cluster.
public long now()