当前位置: 首页>>代码示例>>Java>>正文


Java RxJavaHooks.setOnIOScheduler方法代码示例

本文整理汇总了Java中rx.plugins.RxJavaHooks.setOnIOScheduler方法的典型用法代码示例。如果您正苦于以下问题:Java RxJavaHooks.setOnIOScheduler方法的具体用法?Java RxJavaHooks.setOnIOScheduler怎么用?Java RxJavaHooks.setOnIOScheduler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.plugins.RxJavaHooks的用法示例。


在下文中一共展示了RxJavaHooks.setOnIOScheduler方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxAndroidPlugins.getInstance().reset();
            RxAndroidPlugins.getInstance().registerSchedulersHook(mRxAndroidSchedulersHook);

            RxJavaHooks.reset();
            RxJavaHooks.setOnIOScheduler(mRxJavaImmediateScheduler);
            RxJavaHooks.setOnNewThreadScheduler(mRxJavaImmediateScheduler);

            base.evaluate();

            RxAndroidPlugins.getInstance().reset();
            RxJavaHooks.reset();
        }
    };
}
 
开发者ID:OHoussein,项目名称:Android-Show-Reader,代码行数:20,代码来源:RxSchedulersOverrideRule.java

示例2: apply

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxAndroidPlugins.getInstance().reset();
            RxAndroidPlugins.getInstance().registerSchedulersHook(rxAndroidSchedulersHook);

            RxJavaHooks.reset();
            RxJavaHooks.setOnIOScheduler(rxJavaSchedulerHook);
            RxJavaHooks.setOnNewThreadScheduler(rxJavaSchedulerHook);
            RxJavaHooks.setOnComputationScheduler(rxJavaSchedulerHook);

            base.evaluate();

            RxAndroidPlugins.getInstance().reset();
            RxJavaHooks.reset();
        }
    };
}
 
开发者ID:Plastix,项目名称:RxSchedulerRule,代码行数:21,代码来源:RxSchedulerRule.java

示例3: apply

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@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();
        }
    };
}
 
开发者ID:ArturVasilov,项目名称:RxLoader,代码行数:20,代码来源:RxSchedulersTestRule.java

示例4: apply

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxJavaHooks.reset();
            RxAndroidPlugins.getInstance().reset();

            RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate());
            RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate());
            RxJavaHooks.setOnComputationScheduler(scheduler -> Schedulers.immediate());
            RxAndroidPlugins.getInstance().registerSchedulersHook(mRxAndroidSchedulersHook);

            base.evaluate();

            RxJavaHooks.reset();
            RxAndroidPlugins.getInstance().reset();
        }
    };
}
 
开发者ID:AnironGlass,项目名称:MVP-Boilerplate,代码行数:21,代码来源:RxSchedulersRule.java

示例5: setup

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
    dockerContainers.rabbit().assertUp();
    rabbitTcpPort = dockerContainers.rabbit().tcpPort();
    rabbitAdminPort = dockerContainers.rabbit().adminPort();
    log.infoWithParams("****** Rabbit broker is up and running *****");

    BrokerAddresses addresses = new BrokerAddresses("amqp://localhost:" + rabbitTcpPort);
    channelFactory = new DefaultChannelFactory(addresses, connectionSettings);
    consumerFactory = new DefaultConsumerFactory(channelFactory, consumeSettings);
    publisherFactory = new DefaultPublisherFactory(channelFactory, publishSettings);
    httpClient = new AsyncHttpClient();

    messagesSeen.clear();
    createQueues(channelFactory, inputQueue, new Exchange(inputExchange));
    publisher = publisherFactory.createPublisher();
    RxJavaHooks.setOnIOScheduler(null);
}
 
开发者ID:meltwater,项目名称:rxrabbit,代码行数:19,代码来源:RxRabbitTests.java

示例6: setUp

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Before
public void setUp() {
    BaseActivity activity = Robolectric.setupActivity(UserActivity.class);

    // ユースケースのモック
    User user = new User();
    user.id = 1L;
    user.login = "user";
    GetUserUseCase getUserUseCase = mock(GetUserUseCase.class);
    when(getUserUseCase.run("user")).thenReturn(Single.just(user));
    when(getUserUseCase.run("wrong")).thenReturn(Single.error(new Throwable("error")));

    // イベントバスのモック
    eventBus = mock(EventBus.class);

    // ビューモデルの作成
    userViewModel = new UserActivityViewModel(activity, getUserUseCase, eventBus);

    // subscribeOnのスレッドをioからimmediateに変更
    RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate());
}
 
开发者ID:kobakei,项目名称:Anago,代码行数:22,代码来源:UserActivityViewModelTest.java

示例7: onStart

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Override
public void onStart() {
    RxJavaHooks.setOnIOScheduler(new Func1<Scheduler, Scheduler>() {
        @Override
        public Scheduler call(Scheduler originalScheduler) {
            return Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR);
        }
    });
    super.onStart();
}
 
开发者ID:sumio,项目名称:espresso-sample-for-droidkaigi2017,代码行数:11,代码来源:RxEspressoTestRunner.java

示例8: setupTestSchedulers

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
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) {
    }
}
 
开发者ID:ArturVasilov,项目名称:AndroidArchitecture,代码行数:15,代码来源:RxUtils.java

示例9: setupTestSchedulers

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
public static void setupTestSchedulers() {
    try {
        RxJavaHooks.setOnIOScheduler(current -> Schedulers.immediate());
        RxJavaHooks.setOnComputationScheduler(current -> Schedulers.immediate());

        RxAndroidPlugins.getInstance().registerSchedulersHook(new RxAndroidSchedulersHook() {
            @Override
            public Scheduler getMainThreadScheduler() {
                return Schedulers.immediate();
            }
        });
    } catch (IllegalStateException ignored) {
    }
}
 
开发者ID:ArturVasilov,项目名称:AndroidArchitecture,代码行数:15,代码来源:MockUtils.java

示例10: open

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
public static void open() {
    RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate());
    RxJavaHooks.setOnComputationScheduler(scheduler -> Schedulers.immediate());
    RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate());
    final RxAndroidPlugins rxAndroidPlugins = RxAndroidPlugins.getInstance();
    rxAndroidPlugins.registerSchedulersHook(new RxAndroidSchedulersHook() {
        @Override
        public Scheduler getMainThreadScheduler() {
            return Schedulers.immediate();
        }
    });
}
 
开发者ID:850759383,项目名称:ZhihuDailyNews,代码行数:13,代码来源:RxTools.java

示例11: apply

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Override
public Statement apply(Statement base, Description description) {
    return new Statement() {
        @Override
        public void evaluate() throws Throwable {
            RxJavaHooks.reset();
            RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate());
            RxJavaHooks.setOnNewThreadScheduler(scheduler -> Schedulers.immediate());
            RxJavaHooks.setOnComputationScheduler(scheduler -> Schedulers.immediate());
            base.evaluate();
            RxJavaHooks.reset();
        }
    };
}
 
开发者ID:DanielSerdyukov,项目名称:droidcon2016,代码行数:15,代码来源:ImmediateSchedulerTestRule.java

示例12: setupTestSchedulers

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
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
    }
}
 
开发者ID:ArturVasilov,项目名称:AndroidSchool,代码行数:16,代码来源:RxJUnitRunner.java

示例13: consumer_closes_internal_subscriber_on_error_during_connection

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Test
public void consumer_closes_internal_subscriber_on_error_during_connection() throws Exception {
    MonitoringTestThreadFactory threadFactory = new MonitoringTestThreadFactory();
    Scheduler threadPoolScheduler = new CachedThreadScheduler(threadFactory);
    RxJavaHooks.setOnIOScheduler((ioScheduler) -> threadPoolScheduler);

    CountDownLatch retries = new CountDownLatch(10);

    ConsumerSettings consumerSettings = new ConsumerSettings()
            .withRetryCount(ConsumerSettings.RETRY_FOREVER)
            .withNumChannels(1)
            .withPreFetchCount(1024)
            .withBackoffAlgorithm(integer -> {
                retries.countDown();
                return 1;
            });

    Observable<Message> consumer = new DefaultConsumerFactory(channelFactory, consumerSettings)
            .createConsumer("non-existent-queue");

    Subscription subscribe = consumer.subscribe();

    retries.await();
    subscribe.unsubscribe();

    assertThat(threadFactory.getAliveThreads(), lessThan(10));
}
 
开发者ID:meltwater,项目名称:rxrabbit,代码行数:28,代码来源:RxRabbitTests.java

示例14: setUp

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
@Before
public void setUp() {
    followerDetailsPresenter.attachView(viewMock);
    when(errorControllerMock.getThrowableMessage(any(Throwable.class))).thenCallRealMethod();

    RxJavaHooks.setOnIOScheduler(scheduler -> Schedulers.immediate());

    when(followersControllerMock.isUserFollowed(anyLong())).thenReturn(Single.just(true));
}
 
开发者ID:netguru,项目名称:inbbbox-android,代码行数:10,代码来源:UserPresenterTest.java

示例15: replaceRxSchedulerWithAsyncTask

import rx.plugins.RxJavaHooks; //导入方法依赖的package包/类
private void replaceRxSchedulerWithAsyncTask() {
    RxJavaHooks.setOnComputationScheduler(old -> Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR));
    RxJavaHooks.setOnIOScheduler(old -> Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR));
    RxJavaHooks.setOnNewThreadScheduler(old -> Schedulers.from(AsyncTask.THREAD_POOL_EXECUTOR));
}
 
开发者ID:sumio,项目名称:RxJavaEspressoSample,代码行数:6,代码来源:ActivityAsyncTaskExecutorTest.java


注:本文中的rx.plugins.RxJavaHooks.setOnIOScheduler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。