本文整理汇总了Java中io.reactivex.CompletableObserver.onComplete方法的典型用法代码示例。如果您正苦于以下问题:Java CompletableObserver.onComplete方法的具体用法?Java CompletableObserver.onComplete怎么用?Java CompletableObserver.onComplete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.CompletableObserver
的用法示例。
在下文中一共展示了CompletableObserver.onComplete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: subscribeActual
import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Override
protected void subscribeActual(final CompletableObserver completableObserver) {
verifyMainThread();
final View view = viewWeakRef.get();
if (view == null) {
completableObserver.onComplete();
return;
}
final ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
completableObserver.onSubscribe(createAnimationDisposable(animator, onAnimationCancelAction));
if (preTransformActions != null) {
applyActions(preTransformActions, animator);
animator.setDuration(NONE).setStartDelay(NONE)
.withEndAction(() -> runAnimation(completableObserver, animator))
.start();
} else {
runAnimation(completableObserver, animator);
}
}
示例2: shouldHonorDisposedWhenCallingOnComplete
import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Test
public void shouldHonorDisposedWhenCallingOnComplete() throws Exception {
// Given
Disposable disposable = mock(Disposable.class);
CompletableObserver childObserver = mock(CompletableObserver.class);
CompletableObserver decoratedObserver = CircuitBreakerOperator.of(circuitBreaker).apply(childObserver);
decoratedObserver.onSubscribe(disposable);
// When
((Disposable) decoratedObserver).dispose();
decoratedObserver.onComplete();
// Then
verify(childObserver, never()).onComplete();
assertSingleSuccessfulCall();
}
示例3: shouldHonorDisposedWhenCallingOnComplete
import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Test
public void shouldHonorDisposedWhenCallingOnComplete() throws Exception {
// Given
Disposable disposable = mock(Disposable.class);
CompletableObserver childObserver = mock(CompletableObserver.class);
CompletableObserver decoratedObserver = BulkheadOperator.of(bulkhead).apply(childObserver);
decoratedObserver.onSubscribe(disposable);
// When
((Disposable) decoratedObserver).dispose();
decoratedObserver.onComplete();
// Then
verify(childObserver, never()).onComplete();
assertThat(bulkhead.getMetrics().getAvailableConcurrentCalls()).isEqualTo(1);
}
示例4: fromCompletableObserver
import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
/**
* MaybeConsumer<Success> is very similar to {@link CompletableObserver} in JavaRX. Both are
* looking for either a signal that a process has succeeded, or that it has failed with some
* exception. For the time period where we are still using both interfaces, we will find it
* useful to be able to switch between them.
*
* @return a {@link MaybeConsumer<Success>} that pipes {@link MaybeConsumer#success(Object)}
* to {@link CompletableObserver#onComplete()}, and
* {@link MaybeConsumer#fail(Exception)} to
* {@link CompletableObserver#onError(Throwable)}
*/
public static MaybeConsumer<Success> fromCompletableObserver(final CompletableObserver o) {
return new MaybeConsumer<Success>() {
@Override
public void success(Success value) {
o.onComplete();
}
@Override
public void fail(Exception e) {
o.onError(e);
}
};
}
示例5: subscribeActual
import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
protected void subscribeActual(CompletableObserver observer) {
run();
observer.onComplete();
}