-
Notifications
You must be signed in to change notification settings - Fork 613
Plugins
David Gross edited this page May 29, 2014
·
9 revisions
Plugins allow you to modify the default behavior of RxJava in several respects.
This plugin allows you to override the default computation, i/o, and new thread Schedulers with Schedulers of your choosing. To do this, extend the class RxJavaDefaultSchedulers and override these methods:
Scheduler getComputationScheduler()Scheduler getIOScheduler()Scheduler getNewThreadScheduler()
Then follow these steps:
- Create an object of the new
RxJavaDefaultSchedulerssubclass you have implemented. - Obtain the global
RxJavaPluginsinstance viaRxJavaPlugins.getInstance(). - Pass your default schedulers object to the
registerDefaultSchedulers()method of that instance.
When you do this, RxJava will begin to use the Schedulers returned by your methods rather than its built-in defaults.