Scheduler instances.
The initial and runtime values of the various scheduler types can be overridden via the
RxJavaPlugins.setInit(scheduler name)SchedulerHandler() and
RxJavaPlugins.set(scheduler name)SchedulerHandler() respectively.
Note that overriding any initial Scheduler via the RxJavaPlugins
has to happen before the Schedulers class is accessed.
Supported system properties (System.getProperty()):
rx3.io-keep-alive-time (long): sets the keep-alive time of the io() Scheduler workers, default is IoScheduler#KEEP_ALIVE_TIME_DEFAULTrx3.io-priority (int): sets the thread priority of the io() Scheduler, default is Thread#NORM_PRIORITYrx3.io-scheduled-release (boolean): true sets the worker release mode of the
io() Scheduler to scheduled, default is false for eager mode.rx3.computation-threads (int): sets the number of threads in the computation() Scheduler, default is the number of available CPUsrx3.computation-priority (int): sets the thread priority of the computation() Scheduler, default is Thread#NORM_PRIORITYrx3.newthread-priority (int): sets the thread priority of the newThread() Scheduler, default is Thread#NORM_PRIORITYrx3.single-priority (int): sets the thread priority of the single() Scheduler, default is Thread#NORM_PRIORITYrx3.purge-enabled (boolean): enables purging of all Scheduler's backing thread pools, default is truerx3.scheduler.use-nanotime (boolean): true instructs Scheduler to use System#nanoTime() for Scheduler#now(TimeUnit),
instead of default System#currentTimeMillis() (false)| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final @NonNull Scheduler | |
| pack-priv static final @NonNull Scheduler | |
| pack-priv static final @NonNull Scheduler | |
| pack-priv static final @NonNull Scheduler | |
| pack-priv static final @NonNull Scheduler |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static @NonNull Scheduler | Returns: aScheduler meant for computation-bound workReturns a default, shared |
| public static @NonNull Scheduler | |
| public static @NonNull Scheduler | Returns: the newScheduler wrapping the Executorthe executor to wrap executor, boolean if interruptibleWorker)true, the tasks submitted to the Scheduler. will
be interrupted when the task is disposed.Wraps an |
| public static @NonNull Scheduler | Returns: the newScheduler wrapping the Executorthe executor to wrap executor, boolean if interruptibleWorker, boolean true, the tasks submitted to the Scheduler. will
be interrupted when the task is disposed.if fair)true, tasks submitted to the Scheduler or Worker will be executed by the underlying Executor one after the other, still
in a FIFO and non-overlapping manner, but allows interleaving with other tasks submitted to the underlying Executor.
If false, the underlying FIFO scheme will execute as many tasks as it can before giving up the underlying Executor thread.Wraps an |
| public static @NonNull Scheduler | |
| public static @NonNull Scheduler | |
| public static void | |
| public static @NonNull Scheduler | |
| public static void | |
| public static @NonNull Scheduler | Returns: aScheduler that queues work on the current threadReturns a default, shared |
| COMPUTATION | back to summary |
|---|---|
| pack-priv static final @NonNull Scheduler COMPUTATION
| |
| IO | back to summary |
|---|---|
| pack-priv static final @NonNull Scheduler IO
| |
| NEW_THREAD | back to summary |
|---|---|
| pack-priv static final @NonNull Scheduler NEW_THREAD
| |
| SINGLE | back to summary |
|---|---|
| pack-priv static final @NonNull Scheduler SINGLE
| |
| TRAMPOLINE | back to summary |
|---|---|
| pack-priv static final @NonNull Scheduler TRAMPOLINE
| |
| Schedulers | back to summary |
|---|---|
| private Schedulers() Utility class. | |
| computation | back to summary |
|---|---|
| public static @NonNull Scheduler computation() Returns a default, shared This can be used for event-loops, processing callbacks and other computational work.
It is not recommended to perform blocking, IO-bound work on this scheduler. Use
The default instance has a backing pool of single-threaded
Unhandled errors will be delivered to the scheduler Thread's
This type of scheduler is less sensitive to leaking
If the
You can control certain properties of this standard scheduler via system properties that have to be set
before the Supported system properties (
The default value of this scheduler can be overridden at initialization time via the
It is possible to create a fresh instance of this scheduler with a custom Operators on the base reactive classes that use this scheduler are marked with the
@ | |
| from | back to summary |
|---|---|
| public static @NonNull Scheduler from(@NonNull Executor executor) Wraps an
If the provided executor doesn't support any of the more specific standard Java executor
APIs, tasks scheduled by this scheduler can't be interrupted when they are
executing but only prevented from running prior to that. In addition, tasks scheduled with
a time delay or periodically will use the
Tasks submitted to the
If the provided executor supports the standard Java
If the provided executor supports the standard Java
The implementation of the Worker of this wrapper Starting, stopping and restarting this scheduler is not supported (no-op) and the provided executor's lifecycle must be managed externally:
Note that the provided
This type of scheduler is less sensitive to leaking
Note that this method returns a new
It is possible to wrap an | |
| from | back to summary |
|---|---|
| public static @NonNull Scheduler from(@NonNull Executor executor, boolean interruptibleWorker) Wraps an
The tasks scheduled by the returned
If the provided executor doesn't support any of the more specific standard Java executor
APIs, tasks scheduled with a time delay or periodically will use the
If the provided executor supports the standard Java
If the provided executor supports the standard Java
The implementation of the Starting, stopping and restarting this scheduler is not supported (no-op) and the provided executor's lifecycle must be managed externally:
Note that the provided
This type of scheduler is less sensitive to leaking
Note that this method returns a new
It is possible to wrap an History: 2.2.6 - experimental
| |
| from | back to summary |
|---|---|
| public static @NonNull Scheduler from(@NonNull Executor executor, boolean interruptibleWorker, boolean fair) Wraps an
The tasks scheduled by the returned
If the provided executor doesn't support any of the more specific standard Java executor
APIs, tasks scheduled with a time delay or periodically will use the
If the provided executor supports the standard Java
If the provided executor supports the standard Java
The implementation of the Worker of this wrapper Starting, stopping and restarting this scheduler is not supported (no-op) and the provided executor's lifecycle must be managed externally:
Note that the provided
This type of scheduler is less sensitive to leaking
Note that this method returns a new
It is possible to wrap an
| |
| io | back to summary |
|---|---|
| public static @NonNull Scheduler io() Returns a default, shared This can be used for asynchronously performing blocking IO.
The implementation is backed by a pool of single-threaded
It is not recommended to perform computational work on this scheduler. Use
Unhandled errors will be delivered to the scheduler Thread's
You can control certain properties of this standard scheduler via system properties that have to be set
before the Supported system properties (
The default value of this scheduler can be overridden at initialization time via the
It is possible to create a fresh instance of this scheduler with a custom Operators on the base reactive classes that use this scheduler are marked with the
@
When the
| |
| newThread | back to summary |
|---|---|
| public static @NonNull Scheduler newThread() Returns a default, shared
The default implementation of this scheduler creates a new, single-threaded
Unhandled errors will be delivered to the scheduler Thread's
You can control certain properties of this standard scheduler via system properties that have to be set
before the Supported system properties (
The default value of this scheduler can be overridden at initialization time via the
It is possible to create a fresh instance of this scheduler with a custom Operators on the base reactive classes that use this scheduler are marked with the
@ | |
| shutdown | back to summary |
|---|---|
| public static void shutdown() Shuts down the standard The operation is idempotent and thread-safe. | |
| single | back to summary |
|---|---|
| public static @NonNull Scheduler single() Returns a default, shared, single-thread-backed Uses:
Unhandled errors will be delivered to the scheduler Thread's
This type of scheduler is less sensitive to leaking
If the
You can control certain properties of this standard scheduler via system properties that have to be set
before the Supported system properties (
The default value of this scheduler can be overridden at initialization time via the
It is possible to create a fresh instance of this scheduler with a custom Operators on the base reactive classes that use this scheduler are marked with the
@ | |
| start | back to summary |
|---|---|
| public static void start() Starts the standard The operation is idempotent and thread-safe. | |
| trampoline | back to summary |
|---|---|
| public static @NonNull Scheduler trampoline() Returns a default, shared
The default implementation's Note that this scheduler can't be reliably used to return the execution of tasks to the "main" thread. Such behavior requires a blocking-queueing scheduler currently not provided by RxJava itself but may be found in external libraries.
This scheduler can't be overridden via an | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| DEFAULT | back to summary |
|---|---|
| pack-priv static final Scheduler DEFAULT | |
| ComputationHolder | back to summary |
|---|---|
| pack-priv ComputationHolder() | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Scheduler | get()
Implements io. |
| ComputationTask | back to summary |
|---|---|
| pack-priv ComputationTask() | |
| get | back to summary |
|---|---|
| public Scheduler get() Implements io. Doc from io. Produces a value or throws an exception. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| DEFAULT | back to summary |
|---|---|
| pack-priv static final Scheduler DEFAULT | |
| IoHolder | back to summary |
|---|---|
| pack-priv IoHolder() | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Scheduler | get()
Implements io. |
| IOTask | back to summary |
|---|---|
| pack-priv IOTask() | |
| get | back to summary |
|---|---|
| public Scheduler get() Implements io. Doc from io. Produces a value or throws an exception. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| DEFAULT | back to summary |
|---|---|
| pack-priv static final Scheduler DEFAULT | |
| NewThreadHolder | back to summary |
|---|---|
| pack-priv NewThreadHolder() | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Scheduler | get()
Implements io. |
| NewThreadTask | back to summary |
|---|---|
| pack-priv NewThreadTask() | |
| get | back to summary |
|---|---|
| public Scheduler get() Implements io. Doc from io. Produces a value or throws an exception. | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| DEFAULT | back to summary |
|---|---|
| pack-priv static final Scheduler DEFAULT | |
| SingleHolder | back to summary |
|---|---|
| pack-priv SingleHolder() | |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Scheduler | get()
Implements io. |
| SingleTask | back to summary |
|---|---|
| pack-priv SingleTask() | |
| get | back to summary |
|---|---|
| public Scheduler get() Implements io. Doc from io. Produces a value or throws an exception. | |