本文整理汇总了Java中io.reactivex.schedulers.Schedulers.trampoline方法的典型用法代码示例。如果您正苦于以下问题:Java Schedulers.trampoline方法的具体用法?Java Schedulers.trampoline怎么用?Java Schedulers.trampoline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.schedulers.Schedulers
的用法示例。
在下文中一共展示了Schedulers.trampoline方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postToObservable
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
/**
* 用于处理订阅事件在那个线程中执行
*
* @param observable d
* @param subscriberMethod d
* @return Observable
*/
private Flowable postToObservable(Flowable observable, SubscriberMethod subscriberMethod) {
Scheduler scheduler;
switch (subscriberMethod.threadMode) {
case MAIN:
scheduler = AndroidSchedulers.mainThread();
break;
case NEW_THREAD:
scheduler = Schedulers.newThread();
break;
case CURRENT_THREAD:
scheduler = Schedulers.trampoline();
break;
default:
throw new IllegalStateException("Unknown thread mode: " + subscriberMethod.threadMode);
}
return observable.observeOn(scheduler);
}
示例2: beforeEachTest
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Before public void beforeEachTest() {
MockitoAnnotations.initMocks(this);
Scheduler uiScheduler = Schedulers.trampoline();
view = new FakeDisplayFactsView(onNext, onError, onCompleted);
BehavioursCoordinator<FactAboutNumber> coordinator = new BehavioursCoordinator<>(
new AssignEmptyState<>(view, uiScheduler),
new AssignErrorState<>(view, uiScheduler),
new LoadingCoordination<>(view, uiScheduler),
new NetworkingErrorFeedback<>(view, uiScheduler),
new RefreshToogle<>(view, uiScheduler)
);
presenter = new FactsPresenter(
usecase,
view,
coordinator,
strategist,
domainData -> new NumberAndFact(domainData.number, domainData.fact)
);
}
示例3: getInitMainThreadSchedulerHandlerReturnsHandler
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void getInitMainThreadSchedulerHandlerReturnsHandler() {
Function<Callable<Scheduler>, Scheduler> handler = new Function<Callable<Scheduler>, Scheduler>() {
@Override public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
return Schedulers.trampoline();
}
};
RxAndroidPlugins.setInitMainThreadSchedulerHandler(handler);
assertSame(handler, RxAndroidPlugins.getInitMainThreadSchedulerHandler());
}
示例4: getMainThreadSchedulerHandlerReturnsHandler
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void getMainThreadSchedulerHandlerReturnsHandler() {
Function<Scheduler, Scheduler> handler = new Function<Scheduler, Scheduler>() {
@Override public Scheduler apply(Scheduler scheduler) {
return Schedulers.trampoline();
}
};
RxAndroidPlugins.setMainThreadSchedulerHandler(handler);
assertSame(handler, RxAndroidPlugins.getOnMainThreadSchedulerHandler());
}
示例5: getInitMainThreadSchedulerHandlerReturnsHandler
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void getInitMainThreadSchedulerHandlerReturnsHandler() {
Function<Callable<Scheduler>, Scheduler> handler = new Function<Callable<Scheduler>, Scheduler>() {
@Override
public Scheduler apply(Callable<Scheduler> schedulerCallable) throws Exception {
return Schedulers.trampoline();
}
};
RxSwtPlugins.setInitMainThreadSchedulerHandler(handler);
assertSame(handler, RxSwtPlugins.getInitMainThreadSchedulerHandler());
}
示例6: getMainThreadSchedulerHandlerReturnsHandler
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Test
public void getMainThreadSchedulerHandlerReturnsHandler() {
Function<Scheduler, Scheduler> handler = new Function<Scheduler, Scheduler>() {
@Override
public Scheduler apply(Scheduler scheduler) {
return Schedulers.trampoline();
}
};
RxSwtPlugins.setMainThreadSchedulerHandler(handler);
assertSame(handler, RxSwtPlugins.getOnMainThreadSchedulerHandler());
}
示例7: io
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Scheduler io() {
return Schedulers.trampoline();
}
示例8: io
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
@Override
public Scheduler io() {
return Schedulers.trampoline();
}
示例9: ui
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Scheduler ui() {
return Schedulers.trampoline();
}
示例10: trampoline
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Scheduler trampoline()
{
return Schedulers.trampoline();
}
示例11: setUp
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
messageViewModel = new MessageViewModel(messageRepository, messageCache, userResolver, urlResolver);
sendScheduler = Schedulers.trampoline();
}
示例12: ui
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
@Override
public Scheduler ui() {
return Schedulers.trampoline();
}
示例13: getScheduler
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
public Scheduler getScheduler() {
return Schedulers.trampoline();
}
示例14: multi
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
@Override
public Scheduler multi() {
return Schedulers.trampoline();
}
示例15: computation
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
@Override
public Scheduler computation() {
return Schedulers.trampoline();
}