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


Java CompletableObserver.onSubscribe方法代码示例

本文整理汇总了Java中io.reactivex.CompletableObserver.onSubscribe方法的典型用法代码示例。如果您正苦于以下问题:Java CompletableObserver.onSubscribe方法的具体用法?Java CompletableObserver.onSubscribe怎么用?Java CompletableObserver.onSubscribe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在io.reactivex.CompletableObserver的用法示例。


在下文中一共展示了CompletableObserver.onSubscribe方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: shouldHonorDisposedWhenCallingOnError

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Test
public void shouldHonorDisposedWhenCallingOnError() 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.onError(new IllegalStateException());

    // Then
    verify(childObserver, never()).onError(any());
    assertSingleFailedCall();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:17,代码来源:CircuitBreakerCompletableObserverTest.java

示例4: 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

示例5: shouldHonorDisposedWhenCallingOnError

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Test
public void shouldHonorDisposedWhenCallingOnError() 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.onError(new IllegalStateException());

    // Then
    verify(childObserver, never()).onError(any());
    assertThat(bulkhead.getMetrics().getAvailableConcurrentCalls()).isEqualTo(1);
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:17,代码来源:BulkheadCompletableObserverTest.java

示例6: shouldNotReleaseBulkheadWhenWasDisposedAfterNotPermittedSubscribe

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Test
public void shouldNotReleaseBulkheadWhenWasDisposedAfterNotPermittedSubscribe() throws Exception {
    // Given
    Disposable disposable = mock(Disposable.class);
    CompletableObserver childObserver = mock(CompletableObserver.class);
    CompletableObserver decoratedObserver = BulkheadOperator.of(bulkhead).apply(childObserver);
    bulkhead.isCallPermitted();
    assertThat(bulkhead.getMetrics().getAvailableConcurrentCalls()).isEqualTo(0);
    decoratedObserver.onSubscribe(disposable);

    // When
    ((Disposable) decoratedObserver).dispose();

    // Then
    assertThat(bulkhead.getMetrics().getAvailableConcurrentCalls()).isEqualTo(0);
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:17,代码来源:BulkheadCompletableObserverTest.java

示例7: subscribeActual

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Override
protected void subscribeActual(final CompletableObserver completableObserver) {
    verifyMainThread();
    final UpdateListener updateListener = new UpdateListener(completableObserver, valueUpdateAction);
    final AnimationEndListener endListener = new AnimationEndListener(completableObserver, valueAnimator, animationCancelAction);
    final ValueAnimatorDisposable animatorDisposable = new ValueAnimatorDisposable(valueAnimator, updateListener, endListener);
    completableObserver.onSubscribe(animatorDisposable);

    valueAnimator.addUpdateListener(updateListener);
    valueAnimator.addListener(endListener);
    valueAnimator.start();
}
 
开发者ID:0ximDigital,项目名称:Rx2Animations,代码行数:13,代码来源:RxValueAnimator.java

示例8: subscribeActual

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Override
protected void subscribeActual(CompletableObserver observer) {
    Task<Void> task = run();
    CompletableTaskCallback callback = new CompletableTaskCallback(task, observer);
    observer.onSubscribe(callback);
    task.addOnCompleteListener(callback);
}
 
开发者ID:niqo01,项目名称:RxTask,代码行数:8,代码来源:CompletableTask.java

示例9: shouldNotAffectCircuitBreakerWhenWasDisposedAfterNotPermittedSubscribe

import io.reactivex.CompletableObserver; //导入方法依赖的package包/类
@Test
public void shouldNotAffectCircuitBreakerWhenWasDisposedAfterNotPermittedSubscribe() throws Exception {
    // Given
    Disposable disposable = mock(Disposable.class);
    CompletableObserver childObserver = mock(CompletableObserver.class);
    CompletableObserver decoratedObserver = CircuitBreakerOperator.of(circuitBreaker).apply(childObserver);
    circuitBreaker.transitionToOpenState();
    decoratedObserver.onSubscribe(disposable);

    // When
    ((Disposable) decoratedObserver).dispose();

    // Then
    assertNoRegisteredCall();
}
 
开发者ID:resilience4j,项目名称:resilience4j,代码行数:16,代码来源:CircuitBreakerCompletableObserverTest.java


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