* }
* }</pre>
*/
@SuppressWarnings("deprecation")
public static void initialize() {
RxJavaPlugins plugins = RxJavaPlugins.getInstance();
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();
if (!(existingSchedulers instanceof DefaultSchedulers)) {
throw new IllegalStateException("Cannot install RxJava integration because another set of default schedulers (" + existingSchedulers.getClass() + ") is already installed");
}
}