當前位置: 首頁>>代碼示例>>Java>>正文


Java RxJavaPlugins.setComputationSchedulerHandler方法代碼示例

本文整理匯總了Java中io.reactivex.plugins.RxJavaPlugins.setComputationSchedulerHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java RxJavaPlugins.setComputationSchedulerHandler方法的具體用法?Java RxJavaPlugins.setComputationSchedulerHandler怎麽用?Java RxJavaPlugins.setComputationSchedulerHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在io.reactivex.plugins.RxJavaPlugins的用法示例。


在下文中一共展示了RxJavaPlugins.setComputationSchedulerHandler方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: apply

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, final Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxJavaPlugins.setIoSchedulerHandler(scheduler -> testScheduler);
            RxJavaPlugins.setComputationSchedulerHandler(scheduler -> testScheduler);
            RxJavaPlugins.setNewThreadSchedulerHandler(scheduler -> testScheduler);

            try {
                base.evaluate();
            } finally {
                RxJavaPlugins.reset();
            }
        }
    };
}
 
開發者ID:juxeii,項目名稱:dztools,代碼行數:18,代碼來源:TestSchedulerRule.java

示例2: apply

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, Description description) {
  return new Statement() {
    @Override
    public void evaluate() throws Throwable {
      RxJavaPlugins.reset();
      RxJavaPlugins.setIoSchedulerHandler(scheduler -> Schedulers.trampoline());
      RxJavaPlugins.setComputationSchedulerHandler(scheduler -> Schedulers.trampoline());
      RxJavaPlugins.setNewThreadSchedulerHandler(scheduler -> Schedulers.trampoline());

      try {
        base.evaluate();
      } finally {
        RxJavaPlugins.reset();
      }
    }
  };
}
 
開發者ID:dbof10,項目名稱:redux-observable,代碼行數:19,代碼來源:ImmediateSchedulersRule.java

示例3: before

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Override
protected void before() throws Throwable {
    IdlingResourceScheduler ioIdlingScheduler =
            Rx2Idler.wrap(Schedulers.io(), "RxJava2 Io Idling Scheduler");
    IdlingResourceScheduler computationIdlingScheduler =
            Rx2Idler.wrap(Schedulers.io(), "RxJava2 Computation Idling Scheduler");
    IdlingResourceScheduler newThreadIdlingScheduler =
            Rx2Idler.wrap(Schedulers.io(), "RxJava2 New Thread Idling Scheduler");

    Espresso.registerIdlingResources(
            ioIdlingScheduler, computationIdlingScheduler, newThreadIdlingScheduler
    );

    RxJavaPlugins.setIoSchedulerHandler(scheduler1 -> ioIdlingScheduler);
    RxJavaPlugins.setInitComputationSchedulerHandler(scheduler1 -> computationIdlingScheduler);
    RxJavaPlugins.setComputationSchedulerHandler(scheduler1 -> computationIdlingScheduler);
    RxJavaPlugins.setNewThreadSchedulerHandler(scheduler1 -> newThreadIdlingScheduler);
}
 
開發者ID:ecarrara-araujo,項目名稱:yabaking,代碼行數:19,代碼來源:Rx2IdlingSchedulerRule.java

示例4: apply

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxJavaPlugins.setIoSchedulerHandler(scheduler ->
                    Schedulers.trampoline());
            RxJavaPlugins.setComputationSchedulerHandler(scheduler ->
                    Schedulers.trampoline());
            RxJavaPlugins.setNewThreadSchedulerHandler(scheduler ->
                    Schedulers.trampoline());
            try {
                base.evaluate();
            } finally {
                RxJavaPlugins.reset();
            }
        }
    };
}
 
開發者ID:OlegDokuka,項目名稱:reactive-playing,代碼行數:20,代碼來源:WordServiceWithRuleTest.java

示例5: apply

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxAndroidPlugins.reset();
            RxAndroidPlugins.setMainThreadSchedulerHandler(scheduler -> Schedulers.trampoline());

            RxJavaPlugins.reset();
            RxJavaPlugins.setIoSchedulerHandler(scheduler -> Schedulers.trampoline());
            RxJavaPlugins.setComputationSchedulerHandler(scheduler -> Schedulers.trampoline());
            RxJavaPlugins.setNewThreadSchedulerHandler(scheduler -> Schedulers.trampoline());

            base.evaluate();

            RxAndroidPlugins.reset();
            RxJavaPlugins.reset();
        }
    };
}
 
開發者ID:duyp,項目名稱:mvvm-template,代碼行數:21,代碼來源:RxSchedulersOverrideRule.java

示例6: apply

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxJavaPlugins.setIoSchedulerHandler(scheduler -> Schedulers.trampoline());
            RxJavaPlugins.setComputationSchedulerHandler(scheduler -> Schedulers.trampoline());
            RxJavaPlugins.setNewThreadSchedulerHandler(scheduler -> Schedulers.trampoline());
            RxAndroidPlugins.setMainThreadSchedulerHandler(scheduler -> Schedulers.trampoline());
            try {
                base.evaluate();
            } finally {
                RxJavaPlugins.reset();
            }
        }
    };
}
 
開發者ID:Zeyad-37,項目名稱:RxRedux,代碼行數:18,代碼來源:ImmediateSchedulersRule.java

示例7: shouldCompleteAndReplaceComputationOnTrampoline

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
@Test
public void shouldCompleteAndReplaceComputationOnTrampoline() {
    TestObserver<String> testObserver = TestObserver.create();
    RxJavaPlugins.setComputationSchedulerHandler(old -> Schedulers.trampoline());

    try {
        wordService
                .enumerate(Observable.fromArray(STRINGS))
                .subscribeOn(Schedulers.computation())
                .subscribe(testObserver);

        testObserver
                .assertSubscribed()
                .assertComplete()
                .assertNoErrors()
                .assertValueCount(9)
                .assertValues(
                        " 1. the",
                        " 2. quick",
                        " 3. brown",
                        " 4. fox",
                        " 5. jumped",
                        " 6. over",
                        " 7. the",
                        " 8. lazy",
                        " 9. dog"
                );
    } finally {
        RxJavaPlugins.reset();
    }
}
 
開發者ID:OlegDokuka,項目名稱:reactive-playing,代碼行數:32,代碼來源:WordServiceTest.java

示例8: replaceRxSchedulerWithAsyncTask

import io.reactivex.plugins.RxJavaPlugins; //導入方法依賴的package包/類
private void replaceRxSchedulerWithAsyncTask() {
    RxJavaPlugins.setComputationSchedulerHandler(old -> Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR));
    RxJavaPlugins.setIoSchedulerHandler(old -> Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR));
    RxJavaPlugins.setNewThreadSchedulerHandler(old -> Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR));
}
 
開發者ID:sumio,項目名稱:RxJavaEspressoSample,代碼行數:6,代碼來源:ActivityAsyncTaskExecutorTest.java


注:本文中的io.reactivex.plugins.RxJavaPlugins.setComputationSchedulerHandler方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。