Class RxJavaSchedulersHook



  • public class RxJavaSchedulersHook
    extends Object
    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.

    • Constructor Detail

      • RxJavaSchedulersHook

        protected RxJavaSchedulersHook()
    • Method Detail

      • getComputationScheduler

        public Scheduler getComputationScheduler()
        Scheduler to return from Schedulers.computation() or null if default should be used. This instance should be or behave like a stateless singleton;
      • getIOScheduler

        public Scheduler getIOScheduler()
        Scheduler to return from Schedulers.io() or null if default should be used. This instance should be or behave like a stateless singleton;
      • getNewThreadScheduler

        public Scheduler getNewThreadScheduler()
        Scheduler to return from Schedulers.newThread() or null if default should be used. This instance should be or behave like a stateless singleton;
      • onSchedule

        public Action0 onSchedule(Action0 action)
        Invoked before the Action is handed over to the scheduler. Can be used for wrapping/decorating/logging. The default is just a passthrough.
        Parameters:
        action - action to schedule
        Returns:
        wrapped action to schedule