use of io.reactivex.parallel.ParallelFlowable in project RxJavaInAction by fengzhizi715.
the class ParallelFlowableForParallel method main.
public static void main(String[] args) {
ParallelFlowable parallelFlowable = Flowable.range(1, 100).parallel();
parallelFlowable.runOn(Schedulers.io()).map(new Function<Integer, Object>() {
@Override
public Object apply(@NonNull Integer integer) throws Exception {
return integer.toString();
}
}).sequential().subscribe(new Consumer<String>() {
@Override
public void accept(@NonNull String str) throws Exception {
System.out.println(str);
}
});
}
use of io.reactivex.parallel.ParallelFlowable in project brave by openzipkin.
the class CurrentTraceContextAssemblyTrackingMatrixTest method subscribeInDifferentContext.
TestObserver<Integer> subscribeInDifferentContext(ParallelFlowable<Integer> source, ParallelFlowable<Integer> errorSource) {
source = source.doOnSubscribe(s -> assertInSubscribeContext());
errorSource = errorSource.doOnSubscribe(s -> assertInSubscribeContext());
try (Scope scope2 = currentTraceContext.newScope(subscribeContext)) {
errorSource.sequential().test().assertFailure(IllegalStateException.class);
return source.sequential().toObservable().test();
}
}
Aggregations