本文整理汇总了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();
}
};
}
示例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();
}
};
}
示例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();
}
};
}
示例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();
}
};
}
示例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);
}
示例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());
}
示例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();
}
示例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) {
}
}
示例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) {
}
}
示例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();
}
});
}
示例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();
}
};
}
示例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
}
}
示例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));
}
示例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));
}
示例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));
}