当前位置: 首页>>代码示例>>Java>>正文


Java CompletableObserver.onComplete方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:0ximDigital,项目名称:Rx2Animations,代码行数:23,代码来源:AnimateCompletable.java

示例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();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:17,代码来源:CircuitBreakerCompletableObserverTest.java

示例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);
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:17,代码来源:BulkheadCompletableObserverTest.java

示例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);
        }
    };
}
 
开发者ID:google,项目名称:science-journal,代码行数:25,代码来源:MaybeConsumers.java

示例5: subscribeActual

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
protected void subscribeActual(CompletableObserver observer) {
    run();
    observer.onComplete();
}
 
开发者ID:roadhouse-dev,项目名称:RxDbflow,代码行数:5,代码来源:DBFlowBaseCompletable.java


注:本文中的io.reactivex.CompletableObserver.onComplete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。