本文整理汇总了Java中io.reactivex.schedulers.Schedulers.newThread方法的典型用法代码示例。如果您正苦于以下问题:Java Schedulers.newThread方法的具体用法?Java Schedulers.newThread怎么用?Java Schedulers.newThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.schedulers.Schedulers
的用法示例。
在下文中一共展示了Schedulers.newThread方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getEmpNamesRx
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Flowable<String> getEmpNamesRx() {
Scheduler observerWorker = Schedulers.single();
Scheduler subscriberWorker = Schedulers.newThread();
Function<Employee, String> names = (emp) -> emp.getFirstName() + emp.getLastName();
Flowable<String> emps = Flowable.fromIterable(employeeDaoImpl.getEmployees())
.map(names).observeOn(observerWorker).subscribeOn(subscriberWorker);
return emps;
}
示例3: demo0
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
private void demo0() {
Schedulers.single();
Schedulers.trampoline();
Schedulers.newThread();
Schedulers.computation();
Schedulers.io();
Schedulers.io();
}
示例4: newThread
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@Override
public Scheduler newThread()
{
return Schedulers.newThread();
}
示例5: multi
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
@NonNull
public Scheduler multi(){
return Schedulers.newThread();
}
示例6: provideNewThreadScheduler
import io.reactivex.schedulers.Schedulers; //导入方法依赖的package包/类
/**
* Provides the new thread Scheduler.
*
* @return provides the new thread Scheduler.
*/
@Override
public Scheduler provideNewThreadScheduler() {
return Schedulers.newThread();
}