本文整理了Java中io.reactivex.Single.delaySubscription()
方法的一些代码示例,展示了Single.delaySubscription()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Single.delaySubscription()
方法的具体详情如下:
包路径:io.reactivex.Single
类名称:Single
方法名:delaySubscription
[英]Delays the actual subscription to the current Single until the given time delay elapsed. Scheduler: delaySubscription does by default subscribe to the current Single on the computation Scheduler after the delay.
[中]延迟对当前单曲的实际订阅,直到给定的时间延迟过去。Scheduler:delaySubscription默认情况下会在延迟后订阅计算调度器上的当前单。
代码示例来源:origin: ReactiveX/RxJava
@Override
public Single<Object> apply(Single<Object> s) throws Exception {
return Single.just((Object)1).delaySubscription(s);
}
});
代码示例来源:origin: ReactiveX/RxJava
/**
* Delays the actual subscription to the current Single until the given time delay elapsed.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code delaySubscription} does by default subscribe to the current Single
* on the {@link Scheduler} you provided, after the delay.</dd>
* </dl>
* @param time the time amount to wait with the subscription
* @param unit the time unit of the waiting
* @param scheduler the scheduler to wait on and subscribe on to the current Single
* @return the new Single instance
* @since 2.0
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Single<T> delaySubscription(long time, TimeUnit unit, Scheduler scheduler) {
return delaySubscription(Observable.timer(time, unit, scheduler));
}
代码示例来源:origin: ReactiveX/RxJava
/**
* Delays the actual subscription to the current Single until the given time delay elapsed.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code delaySubscription} does by default subscribe to the current Single
* on the {@code computation} {@link Scheduler} after the delay.</dd>
* </dl>
* @param time the time amount to wait with the subscription
* @param unit the time unit of the waiting
* @return the new Single instance
* @since 2.0
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.COMPUTATION)
public final Single<T> delaySubscription(long time, TimeUnit unit) {
return delaySubscription(time, unit, Schedulers.computation());
}
代码示例来源:origin: redisson/redisson
/**
* Delays the actual subscription to the current Single until the given time delay elapsed.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code delaySubscription} does by default subscribe to the current Single
* on the {@code computation} {@link Scheduler} after the delay.</dd>
* </dl>
* @param time the time amount to wait with the subscription
* @param unit the time unit of the waiting
* @return the new Single instance
* @since 2.0
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.COMPUTATION)
public final Single<T> delaySubscription(long time, TimeUnit unit) {
return delaySubscription(time, unit, Schedulers.computation());
}
代码示例来源:origin: redisson/redisson
/**
* Delays the actual subscription to the current Single until the given time delay elapsed.
* <dl>
* <dt><b>Scheduler:</b></dt>
* <dd>{@code delaySubscription} does by default subscribe to the current Single
* on the {@link Scheduler} you provided, after the delay.</dd>
* </dl>
* @param time the time amount to wait with the subscription
* @param unit the time unit of the waiting
* @param scheduler the scheduler to wait on and subscribe on to the current Single
* @return the new Single instance
* @since 2.0
*/
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.CUSTOM)
public final Single<T> delaySubscription(long time, TimeUnit unit, Scheduler scheduler) {
return delaySubscription(Observable.timer(time, unit, scheduler));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withObservableDispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().delaySubscription(Observable.just(1)));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delaySubscriptionTimeCustomScheduler() throws Exception {
Single.just(1).delaySubscription(100, TimeUnit.MILLISECONDS, Schedulers.io())
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withSingleDispose() {
TestHelper.checkDisposed(Single.just(1).delaySubscription(Single.just(2)));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delaySubscriptionTime() throws Exception {
Single.just(1).delaySubscription(100, TimeUnit.MILLISECONDS)
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withPublisherDispose() {
TestHelper.checkDisposed(PublishSubject.create().singleOrError().delaySubscription(Flowable.just(1)));
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delaySubscriptionSingle() throws Exception {
Single.just(1).delaySubscription(Single.timer(100, TimeUnit.MILLISECONDS))
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withPublisherError() {
Single.just(1)
.delaySubscription(Flowable.error(new TestException()))
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delaySubscriptionFlowable() throws Exception {
Single.just(1).delaySubscription(Flowable.timer(100, TimeUnit.MILLISECONDS))
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withObservableError() {
Single.just(1)
.delaySubscription(Observable.error(new TestException()))
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delaySubscriptionObservable() throws Exception {
Single.just(1).delaySubscription(Observable.timer(100, TimeUnit.MILLISECONDS))
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withSingleErrors() {
Single.just(1)
.delaySubscription(Single.error(new TestException()))
.test()
.assertFailure(TestException.class);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void delaySubscriptionCompletable() throws Exception {
Single.just(1).delaySubscription(Completable.complete().delay(100, TimeUnit.MILLISECONDS))
.test()
.awaitDone(5, TimeUnit.SECONDS)
.assertResult(1);
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withObservableError2() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Single.just(1)
.delaySubscription(new Observable<Integer>() {
@Override
protected void subscribeActual(Observer<? super Integer> observer) {
observer.onSubscribe(Disposables.empty());
observer.onNext(1);
observer.onError(new TestException());
}
})
.test()
.assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
代码示例来源:origin: ReactiveX/RxJava
@Test
public void withPublisherError2() {
List<Throwable> errors = TestHelper.trackPluginErrors();
try {
Single.just(1)
.delaySubscription(new Flowable<Integer>() {
@Override
protected void subscribeActual(Subscriber<? super Integer> s) {
s.onSubscribe(new BooleanSubscription());
s.onNext(1);
s.onError(new TestException());
}
})
.test()
.assertResult(1);
TestHelper.assertUndeliverable(errors, 0, TestException.class);
} finally {
RxJavaPlugins.reset();
}
}
代码示例来源:origin: Polidea/RxAndroidBle
final DisposableSingleObserver<BluetoothGatt> disposableGattObserver = getBluetoothGattAndChangeStatusToConnected()
.delaySubscription(
rxBleGattCallback
.getOnConnectionStateChange()
内容来源于网络,如有侵权,请联系作者删除!