public class RxJavaSchedulersHook
extends java.lang.Object
Scheduler
functionality
1. You may redefine entire schedulers, if you so choose. To do so, override
the 3 methods that return Scheduler (io(), computation(), newThread()).
2. You may wrap/decorate an Action0
, before it is handed off to a Scheduler. The system-
supplied Schedulers (Schedulers.ioScheduler, Schedulers.computationScheduler,
Scheduler.newThreadScheduler) all use this hook, so it's a convenient way to
modify Scheduler functionality without redefining Schedulers wholesale.
Also, when redefining Schedulers, you are free to use/not use the onSchedule decoration hook.
See RxJavaPlugins
or the RxJava GitHub Wiki for information on configuring plugins:
https://github.com/ReactiveX/RxJava/wiki/Plugins.
Constructor and Description |
---|
RxJavaSchedulersHook() |
Modifier and Type | Method and Description |
---|---|
static Scheduler |
createComputationScheduler()
Create an instance of the default
Scheduler used for Schedulers.computation() . |
static Scheduler |
createComputationScheduler(java.util.concurrent.ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.computation()
except using threadFactory for thread creation. |
static Scheduler |
createIoScheduler()
Create an instance of the default
Scheduler used for Schedulers.io() . |
static Scheduler |
createIoScheduler(java.util.concurrent.ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.io()
except using threadFactory for thread creation. |
static Scheduler |
createNewThreadScheduler()
Create an instance of the default
Scheduler used for Schedulers.newThread() . |
static Scheduler |
createNewThreadScheduler(java.util.concurrent.ThreadFactory threadFactory)
Create an instance of the default
Scheduler used for Schedulers.newThread()
except using threadFactory for thread creation. |
Scheduler |
getComputationScheduler()
Scheduler to return from
Schedulers.computation() or null if default should be
used. |
static RxJavaSchedulersHook |
getDefaultInstance() |
Scheduler |
getIOScheduler()
Scheduler to return from
Schedulers.io() or null if default should be used. |
Scheduler |
getNewThreadScheduler()
Scheduler to return from
Schedulers.newThread() or null if default should be used. |
Action0 |
onSchedule(Action0 action)
Deprecated.
|
public static Scheduler createComputationScheduler()
Scheduler
used for Schedulers.computation()
.public static Scheduler createComputationScheduler(java.util.concurrent.ThreadFactory threadFactory)
Scheduler
used for Schedulers.computation()
except using threadFactory
for thread creation.threadFactory
- the factory to use for each worker threadpublic static Scheduler createIoScheduler()
Scheduler
used for Schedulers.io()
.public static Scheduler createIoScheduler(java.util.concurrent.ThreadFactory threadFactory)
Scheduler
used for Schedulers.io()
except using threadFactory
for thread creation.threadFactory
- the factory to use for each worker threadpublic static Scheduler createNewThreadScheduler()
Scheduler
used for Schedulers.newThread()
.public static Scheduler createNewThreadScheduler(java.util.concurrent.ThreadFactory threadFactory)
Scheduler
used for Schedulers.newThread()
except using threadFactory
for thread creation.threadFactory
- the factory to use for each worker threadpublic Scheduler getComputationScheduler()
Schedulers.computation()
or null if default should be
used.
This instance should be or behave like a stateless singleton;public Scheduler getIOScheduler()
Schedulers.io()
or null if default should be used.
This instance should be or behave like a stateless singleton;public Scheduler getNewThreadScheduler()
Schedulers.newThread()
or null if default should be used.
This instance should be or behave like a stateless singleton;@Deprecated public Action0 onSchedule(Action0 action)
action
- action to schedulepublic static RxJavaSchedulersHook getDefaultInstance()