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.
Supported system properties (System.getProperty()):
rx2.io-keep-alive-time (long): sets the keep-alive time of the io() Scheduler workers, default is IoScheduler#KEEP_ALIVE_TIME_DEFAULTrx2.io-priority (int): sets the thread priority of the io() Scheduler, default is Thread#NORM_PRIORITYrx2.io-scheduled-release (boolean): true sets the worker release mode of the
io() Scheduler to scheduled, default is false for eager mode.rx2.computation-threads (int): sets the number of threads in the computation() Scheduler, default is the number of available CPUsrx2.computation-priority (int): sets the thread priority of the computation() Scheduler, default is Thread#NORM_PRIORITYrx2.newthread-priority (int): sets the thread priority of the newThread() Scheduler, default is Thread#NORM_PRIORITYrx2.single-priority (int): sets the thread priority of the single() Scheduler, default is Thread#NORM_PRIORITYrx2.purge-enabled (boolean): enables periodic purging of all Scheduler's backing thread pools, default is falserx2.purge-period-seconds (int): specifies the periodic purge interval of all Scheduler's backing thread pools, default is 1 secondrx2.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 Scheduler | |
| pack-priv static final Scheduler | |
| pack-priv static final Scheduler | |
| pack-priv static final Scheduler | |
| pack-priv static final Scheduler |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Scheduler | Returns: aScheduler meant for computation-bound workReturns a default, shared |
| public static Scheduler | |
| public static Scheduler | Returns: the new Scheduler 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 Scheduler | |
| public static Scheduler | |
| public static void | |
| public static Scheduler | |
| public static void | |
| public static Scheduler | Returns: aScheduler that queues work on the current threadReturns a default, shared |
| COMPUTATION | back to summary |
|---|---|
| pack-priv static final Scheduler COMPUTATION
| |
| IO | back to summary |
|---|---|
| pack-priv static final Scheduler IO
| |
| NEW_THREAD | back to summary |
|---|---|
| pack-priv static final Scheduler NEW_THREAD
| |
| SINGLE | back to summary |
|---|---|
| pack-priv static final Scheduler SINGLE
| |
| TRAMPOLINE | back to summary |
|---|---|
| pack-priv static final Scheduler TRAMPOLINE
| |
| Schedulers | back to summary |
|---|---|
| private Schedulers() Utility class. | |
| computation | back to summary |
|---|---|
| public static 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 ThreadFactory, via the
Operators on the base reactive classes that use this scheduler are marked with the
@
When the
| |
| from | back to summary |
|---|---|
| public static Scheduler from(Executor executor) Wraps an
If the provided executor doesn't support any of the more specific standard Java executor
APIs, cancelling 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 Starting, stopping and restarting this scheduler is not supported (no-op) and the provided executor's lifecycle must be managed externally:
This type of scheduler is less sensitive to leaking
Note that this method returns a new | |
| from | back to summary |
|---|---|
| public static Scheduler from(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 Starting, stopping and restarting this scheduler is not supported (no-op) and the provided executor's lifecycle must be managed externally:
This type of scheduler is less sensitive to leaking
Note that this method returns a new
| |
| io | back to summary |
|---|---|
| public static 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 ThreadFactory, via the
Operators on the base reactive classes that use this scheduler are marked with the
@ | |
| newThread | back to summary |
|---|---|
| public static 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 ThreadFactory, via the
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 Schedulers. The operation is idempotent and thread-safe. | |
| single | back to summary |
|---|---|
| public static 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 ThreadFactory, via the
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 Schedulers. The operation is idempotent and thread-safe. | |
| trampoline | back to summary |
|---|---|
| public static 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 | call()
Implements java. |
| ComputationTask | back to summary |
|---|---|
| pack-priv ComputationTask() | |
| call | back to summary |
|---|---|
| public Scheduler call() throws Exception Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |
| 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 | call()
Implements java. |
| IOTask | back to summary |
|---|---|
| pack-priv IOTask() | |
| call | back to summary |
|---|---|
| public Scheduler call() throws Exception Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |
| 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 | call()
Implements java. |
| NewThreadTask | back to summary |
|---|---|
| pack-priv NewThreadTask() | |
| call | back to summary |
|---|---|
| public Scheduler call() throws Exception Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |
| 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 | call()
Implements java. |
| SingleTask | back to summary |
|---|---|
| pack-priv SingleTask() | |
| call | back to summary |
|---|---|
| public Scheduler call() throws Exception Implements java. Doc from java. Computes a result, or throws an exception if unable to do so. | |