Java Code Examples for rx.plugins.RxJavaHooks#setOnNewThreadScheduler()
The following examples show how to use
rx.plugins.RxJavaHooks#setOnNewThreadScheduler() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RxSchedulersTestRule.java From AndroidSchool with Apache License 2.0 | 6 votes |
@Override public Statement apply(final Statement base, Description description) { return new Statement() { @Override public void evaluate() throws Throwable { RxJavaHooks.reset(); RxJavaHooks.setOnIOScheduler(mMockSchedulerFunc); RxJavaHooks.setOnNewThreadScheduler(mMockSchedulerFunc); RxAndroidPlugins.getInstance().reset(); RxAndroidPlugins.getInstance().registerSchedulersHook(mRxAndroidSchedulersHook); base.evaluate(); RxJavaHooks.reset(); RxAndroidPlugins.getInstance().reset(); } }; }
Example 2
Source File: RunTestOnContextRx.java From sfs with Apache License 2.0 | 5 votes |
@Override public Statement apply(Statement base, Description description) { Statement st = new Statement() { @Override public void evaluate() throws Throwable { Vertx v = vertx(); RxJavaSchedulersHook hook = RxHelper.schedulerHook(v.getOrCreateContext()); RxJavaHooks.setOnIOScheduler(f -> hook.getIOScheduler()); RxJavaHooks.setOnNewThreadScheduler(f -> hook.getNewThreadScheduler()); RxJavaHooks.setOnComputationScheduler(f -> hook.getComputationScheduler()); base.evaluate(); } }; return super.apply(st, description); }
Example 3
Source File: RxUtils.java From AndroidSchool with Apache License 2.0 | 5 votes |
public static void setupTestSchedulers() { try { RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate()); RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate()); RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }); } catch (IllegalStateException ignored) { } }
Example 4
Source File: RxJUnitRunner.java From AndroidSchool with Apache License 2.0 | 5 votes |
private void setupTestSchedulers() { RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate()); RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate()); try { RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() { @Override public Scheduler getMainThreadScheduler() { return Schedulers.immediate(); } }); } catch (IllegalStateException ignored) { // already registered } }
Example 5
Source File: SfsServer.java From sfs with Apache License 2.0 | 4 votes |
public static void initRxSchedulers(Context context) { RxJavaSchedulersHook hook = RxHelper.schedulerHook(context); RxJavaHooks.setOnIOScheduler(f -> hook.getIOScheduler()); RxJavaHooks.setOnNewThreadScheduler(f -> hook.getNewThreadScheduler()); RxJavaHooks.setOnComputationScheduler(f -> hook.getComputationScheduler()); }
Example 6
Source File: NativeExamples.java From vertx-rx with Apache License 2.0 | 4 votes |
public void schedulerHook(Vertx vertx) { RxJavaSchedulersHook hook = RxHelper.schedulerHook(vertx); RxJavaHooks.setOnIOScheduler(f -> hook.getIOScheduler()); RxJavaHooks.setOnNewThreadScheduler(f -> hook.getNewThreadScheduler()); RxJavaHooks.setOnComputationScheduler(f -> hook.getComputationScheduler()); }
Example 7
Source File: RxifiedExamples.java From vertx-rx with Apache License 2.0 | 4 votes |
public void schedulerHook(Vertx vertx) { RxJavaSchedulersHook hook = io.vertx.rxjava.core.RxHelper.schedulerHook(vertx); RxJavaHooks.setOnIOScheduler(f -> hook.getIOScheduler()); RxJavaHooks.setOnNewThreadScheduler(f -> hook.getNewThreadScheduler()); RxJavaHooks.setOnComputationScheduler(f -> hook.getComputationScheduler()); }