io.reactivex.rxjava3.core.MaybeObserver Java Examples
The following examples show how to use
io.reactivex.rxjava3.core.MaybeObserver.
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)); } }
Example #4
Source File: AbstractMaybeObserver.java From resilience4j with Apache License 2.0 | 4 votes |
public AbstractMaybeObserver(MaybeObserver<? super T> downstreamObserver) { this.downstreamObserver = requireNonNull(downstreamObserver); }
Example #5
Source File: MaybeCircuitBreaker.java From resilience4j with Apache License 2.0 | 4 votes |
CircuitBreakerMaybeObserver(MaybeObserver<? super T> downstreamObserver) { super(downstreamObserver); this.start = System.nanoTime(); }
Example #6
Source File: MaybeBulkhead.java From resilience4j with Apache License 2.0 | 4 votes |
BulkheadMaybeObserver(MaybeObserver<? super T> downstreamObserver) { super(downstreamObserver); }
Example #7
Source File: MaybeRateLimiter.java From resilience4j with Apache License 2.0 | 4 votes |
RateLimiterMaybeObserver(MaybeObserver<? super T> downstreamObserver) { super(downstreamObserver); }
Example #8
Source File: RequestContextSupplierMaybe.java From armeria with Apache License 2.0 | 4 votes |
@Override protected void subscribeActual(MaybeObserver<? super T> s) { try (SafeCloseable ignored = assemblyContext.push()) { source.subscribe(new RequestContextMaybeObserver<>(s, assemblyContext)); } }
Example #9
Source File: RequestContextMaybeObserver.java From armeria with Apache License 2.0 | 4 votes |
RequestContextMaybeObserver(MaybeObserver<T> actual, RequestContext assemblyContext) { this.actual = actual; this.assemblyContext = assemblyContext; }
Example #10
Source File: RequestContextScalarSupplierMaybe.java From armeria with Apache License 2.0 | 4 votes |
@Override protected void subscribeActual(MaybeObserver<? super T> s) { try (SafeCloseable ignored = assemblyContext.push()) { source.subscribe(new RequestContextMaybeObserver<>(s, assemblyContext)); } }
Example #11
Source File: RequestContextMaybe.java From armeria with Apache License 2.0 | 4 votes |
@Override protected void subscribeActual(MaybeObserver<? super T> s) { try (SafeCloseable ignored = assemblyContext.push()) { source.subscribe(new RequestContextMaybeObserver<>(s, assemblyContext)); } }