Java Code Examples for io.reactivex.schedulers.Schedulers#newThread()
The following examples show how to use
io.reactivex.schedulers.Schedulers#newThread() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadModeCastToSchedulersUtil.java From RxEventBus with Apache License 2.0 | 6 votes |
public static Scheduler cast(ThreadMode threadMode) { Scheduler scheduler = null; switch (threadMode) { case COMPUTATION: scheduler = Schedulers.computation(); break; case NEWTHREAD: scheduler = Schedulers.newThread(); break; case MAIN: scheduler = AndroidSchedulers.mainThread(); break; case IO: scheduler = Schedulers.io(); break; default: scheduler = AndroidSchedulers.mainThread(); break; } return scheduler; }
Example 2
Source File: RxBus.java From RxBus2 with Apache License 2.0 | 6 votes |
/** * 用于处理订阅事件在那个线程中执行 * * @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); }
Example 3
Source File: RxBus.java From YiZhi with Apache License 2.0 | 6 votes |
/** * 用于处理订阅事件在那个线程中执行 * * @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); }
Example 4
Source File: EmployeeRxJavaServiceImpl.java From Spring-5.0-Cookbook with MIT License | 5 votes |
@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; }
Example 5
Source File: Sandbox.java From Reactive-Android-Programming with MIT License | 5 votes |
private void demo0() { Schedulers.single(); Schedulers.trampoline(); Schedulers.newThread(); Schedulers.computation(); Schedulers.io(); Schedulers.io(); }
Example 6
Source File: Sandbox.java From Reactive-Android-Programming with MIT License | 5 votes |
private void demo0() { Schedulers.single(); Schedulers.trampoline(); Schedulers.newThread(); Schedulers.computation(); Schedulers.io(); Schedulers.io(); }
Example 7
Source File: SchedulerProvider.java From Melophile with Apache License 2.0 | 4 votes |
@NonNull public Scheduler multi() { return Schedulers.newThread(); }
Example 8
Source File: Rx.java From klingar with Apache License 2.0 | 4 votes |
private static Rx production() { return new Rx(Schedulers.io(), AndroidSchedulers.mainThread(), Schedulers.newThread()); }
Example 9
Source File: SchedulerProviderImplementation.java From NYBus with Apache License 2.0 | 2 votes |
/** * Provides the new thread Scheduler. * * @return provides the new thread Scheduler. */ @Override public Scheduler provideNewThreadScheduler() { return Schedulers.newThread(); }
Example 10
Source File: SchedulerProviderImpl.java From NYBus with Apache License 2.0 | 2 votes |
/** * Provides the new thread Scheduler. * * @return provides the new thread Scheduler. */ @Override public Scheduler provideNewThreadScheduler() { return Schedulers.newThread(); }