本文整理了Java中io.reactivex.Flowable.unsubscribeOn()
方法的一些代码示例,展示了Flowable.unsubscribeOn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flowable.unsubscribeOn()
方法的具体详情如下:
包路径:io.reactivex.Flowable
类名称:Flowable
方法名:unsubscribeOn
[英]Modifies the source Publisher so that subscribers will cancel it on a specified Scheduler. Backpressure: The operator doesn't interfere with backpressure which is determined by the source Publisher's backpressure behavior. Scheduler: You specify which Scheduler this operator will use.
[中]修改源发布服务器,以便订阅服务器在指定的计划程序上取消它。背压:操作员不会干扰由源发布者的背压行为确定的背压。计划程序:指定此操作员将使用的计划程序。
代码示例来源:origin: ReactiveX/RxJava
@Test(expected = NullPointerException.class)
public void unsubscribeOnNull() {
just1.unsubscribeOn(null);
}
代码示例来源:origin: ReactiveX/RxJava
@Override
public Publisher<Integer> createPublisher(long elements) {
return
Flowable.range(0, (int)elements * 2)
.unsubscribeOn(Schedulers.single())
.take(elements)
;
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void dispose() {
TestHelper.checkDisposed(Flowable.just(1).unsubscribeOn(Schedulers.single()));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void normal() {
final int[] calls = { 0 };
Flowable.just(1)
.doOnCancel(new Action() {
@Override
public void run() throws Exception {
calls[0]++;
}
})
.unsubscribeOn(Schedulers.single())
.test()
.assertResult(1);
assertEquals(0, calls[0]);
}
代码示例来源:origin: ReactiveX/RxJava
.unsubscribeOn(uiEventLoop)
.take(2)
.subscribe(ts);
代码示例来源:origin: ReactiveX/RxJava
.unsubscribeOn(uiEventLoop)
.take(2)
.subscribe(ts);
代码示例来源:origin: ReactiveX/RxJava
@Test
public void error() {
final int[] calls = { 0 };
Flowable.error(new TestException())
.doOnCancel(new Action() {
@Override
public void run() throws Exception {
calls[0]++;
}
})
.unsubscribeOn(Schedulers.single())
.test()
.assertFailure(TestException.class);
assertEquals(0, calls[0]);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void takeHalf() {
int elements = 1024;
Flowable.range(0, elements * 2).unsubscribeOn(Schedulers.single())
.take(elements)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertValueCount(elements)
.assertComplete()
.assertNoErrors()
.assertSubscribed();
}
代码示例来源:origin: forkachild/reel-search-android
public static <U> FlowableTransformer<U, U> composeFlowable() {
return upstream -> upstream
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.unsubscribeOn(Schedulers.io());
}
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
};
代码示例来源:origin: leftcoding/GankLy
protected <T> Flowable<T> toObservable(Flowable<T> o) {
return o.retry(3)
.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
}
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.io())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.computation())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.computation())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.computation())
.unsubscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.computation())
.unsubscribeOn(Schedulers.io())
.observeOn(Schedulers.io());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.newThread())
.unsubscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.newThread())
.unsubscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread());
}
};
代码示例来源:origin: qyxxjd/BaseProject
@Override
public Publisher apply(@NonNull io.reactivex.Flowable upstream) {
return upstream.subscribeOn(Schedulers.newThread())
.unsubscribeOn(Schedulers.newThread())
.observeOn(Schedulers.newThread());
}
};
内容来源于网络,如有侵权,请联系作者删除!