ExecutionHook ourHook = new ExecutionHook();
try {
plugins.registerObservableExecutionHook(ourHook);
} catch (IllegalStateException e) {
RxJavaObservableExecutionHook existingHook = plugins.getObservableExecutionHook();
if (!(existingHook instanceof ExecutionHook)) {
throw new IllegalStateException("Cannot install RxJava integration because another execution hook (" + existingHook.getClass() + ") is already installed");
}
}
System.setProperty("rxjava.plugin." + RxJavaSchedulersHook.class.getSimpleName() + ".implementation", DefaultSchedulers.class.getName());
rx.plugins.RxJavaSchedulersHook existingSchedulers = plugins.getSchedulersHook();