Java Code Examples for io.reactivex.rxjava3.core.MaybeObserver#onError()
The following examples show how to use
io.reactivex.rxjava3.core.MaybeObserver#onError() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaybeCircuitBreaker.java From resilience4j with Apache License 2.0 | 5 votes |
@Override protected void subscribeActual(MaybeObserver<? super T> downstream) { if (circuitBreaker.tryAcquirePermission()) { upstream.subscribe(new CircuitBreakerMaybeObserver(downstream)); } else { downstream.onSubscribe(EmptyDisposable.INSTANCE); downstream.onError(createCallNotPermittedException(circuitBreaker)); } }
Example 2
Source File: MaybeBulkhead.java From resilience4j with Apache License 2.0 | 5 votes |
@Override protected void subscribeActual(MaybeObserver<? super T> downstream) { if (bulkhead.tryAcquirePermission()) { upstream.subscribe(new BulkheadMaybeObserver(downstream)); } else { downstream.onSubscribe(EmptyDisposable.INSTANCE); downstream.onError(BulkheadFullException.createBulkheadFullException(bulkhead)); } }
Example 3
Source File: MaybeRateLimiter.java From resilience4j with Apache License 2.0 | 5 votes |
@Override protected void subscribeActual(MaybeObserver<? super T> downstream) { long waitDuration = rateLimiter.reservePermission(); if (waitDuration >= 0) { if (waitDuration > 0) { Completable.timer(waitDuration, TimeUnit.NANOSECONDS) .subscribe(() -> upstream.subscribe(new RateLimiterMaybeObserver(downstream))); } else { upstream.subscribe(new RateLimiterMaybeObserver(downstream)); } } else { downstream.onSubscribe(EmptyDisposable.INSTANCE); downstream.onError(RequestNotPermitted.createRequestNotPermitted(rateLimiter)); } }