Package rx.plugins
Class RxJavaSchedulersHook
java.lang.Object
rx.plugins.RxJavaSchedulersHook
This plugin class provides 2 ways to customize
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Scheduler
Create an instance of the defaultScheduler
used forSchedulers.computation()
.static Scheduler
createComputationScheduler
(ThreadFactory threadFactory) Create an instance of the defaultScheduler
used forSchedulers.computation()
except usingthreadFactory
for thread creation.static Scheduler
Create an instance of the defaultScheduler
used forSchedulers.io()
.static Scheduler
createIoScheduler
(ThreadFactory threadFactory) Create an instance of the defaultScheduler
used forSchedulers.io()
except usingthreadFactory
for thread creation.static Scheduler
Create an instance of the defaultScheduler
used forSchedulers.newThread()
.static Scheduler
createNewThreadScheduler
(ThreadFactory threadFactory) Create an instance of the defaultScheduler
used forSchedulers.newThread()
except usingthreadFactory
for thread creation.Scheduler to return fromSchedulers.computation()
or null if default should be used.static RxJavaSchedulersHook
Scheduler to return fromSchedulers.io()
or null if default should be used.Scheduler to return fromSchedulers.newThread()
or null if default should be used.onSchedule
(Action0 action) Deprecated.
-
Field Details
-
DEFAULT_INSTANCE
-
-
Constructor Details
-
RxJavaSchedulersHook
public RxJavaSchedulersHook()
-
-
Method Details
-
createComputationScheduler
Create an instance of the defaultScheduler
used forSchedulers.computation()
.- Returns:
- the created Scheduler instance
-
createComputationScheduler
Create an instance of the defaultScheduler
used forSchedulers.computation()
except usingthreadFactory
for thread creation.- Parameters:
threadFactory
- the factory to use for each worker thread- Returns:
- the created Scheduler instance
-
createIoScheduler
Create an instance of the defaultScheduler
used forSchedulers.io()
.- Returns:
- the created Scheduler instance
-
createIoScheduler
Create an instance of the defaultScheduler
used forSchedulers.io()
except usingthreadFactory
for thread creation.- Parameters:
threadFactory
- the factory to use for each worker thread- Returns:
- the created Scheduler instance
-
createNewThreadScheduler
Create an instance of the defaultScheduler
used forSchedulers.newThread()
.- Returns:
- the created Scheduler instance
-
createNewThreadScheduler
Create an instance of the defaultScheduler
used forSchedulers.newThread()
except usingthreadFactory
for thread creation.- Parameters:
threadFactory
- the factory to use for each worker thread- Returns:
- the created Scheduler instance
-
getComputationScheduler
Scheduler to return fromSchedulers.computation()
or null if default should be used. This instance should be or behave like a stateless singleton;- Returns:
- the current computation scheduler instance
-
getIOScheduler
Scheduler to return fromSchedulers.io()
or null if default should be used. This instance should be or behave like a stateless singleton;- Returns:
- the created Scheduler instance
-
getNewThreadScheduler
Scheduler to return fromSchedulers.newThread()
or null if default should be used. This instance should be or behave like a stateless singleton;- Returns:
- the current new thread scheduler instance
-
onSchedule
Deprecated.Invoked before the Action is handed over to the scheduler. Can be used for wrapping/decorating/logging. The default is just a pass through.- Parameters:
action
- action to schedule- Returns:
- wrapped action to schedule
-
getDefaultInstance
-