Java Code Examples for reactor.core.publisher.Operators#onErrorDropped()
The following examples show how to use
reactor.core.publisher.Operators#onErrorDropped() .
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: ResolvingOperator.java From rsocket-java with Apache License 2.0 | 6 votes |
@SuppressWarnings("unchecked") final void terminate(Throwable t) { if (isDisposed()) { return; } // writes happens before volatile write this.t = t; final BiConsumer<T, Throwable>[] subscribers = SUBSCRIBERS.getAndSet(this, TERMINATED); if (subscribers == TERMINATED) { Operators.onErrorDropped(t, Context.empty()); return; } this.doOnDispose(); this.doFinally(); for (BiConsumer<T, Throwable> consumer : subscribers) { consumer.accept(null, t); } }
Example 2
Source File: SimplePool.java From reactor-pool with Apache License 2.0 | 6 votes |
@Override public void onError(Throwable throwable) { QueuePooledRef<T> slot = pooledRef; pooledRef = null; if (slot == null) { Operators.onErrorDropped(throwable, actual.currentContext()); return; } //some operators might immediately produce without request (eg. fromRunnable) // we decrement ACQUIRED EXACTLY ONCE to indicate that the poolable was released by the user if (ONCE.compareAndSet(this, 0, 1)) { ACQUIRED.decrementAndGet(pool); } //TODO should we separate reset errors? pool.metricsRecorder.recordResetLatency(pool.clock.millis() - start); if (slot.markInvalidate()) { pool.destroyPoolable(slot).subscribe(null, null, pool::drain); //TODO manage errors? } actual.onError(throwable); }
Example 3
Source File: DefaultRSocketClient.java From rsocket-java with Apache License 2.0 | 6 votes |
@Override public void onError(Throwable t) { final Subscription s = this.s; if (s == Operators.cancelledSubscription() || S.getAndSet(this, Operators.cancelledSubscription()) == Operators.cancelledSubscription()) { this.doFinally(); Operators.onErrorDropped(t, Context.empty()); return; } this.doFinally(); // terminate upstream which means retryBackoff has exhausted this.terminate(t); }
Example 4
Source File: ReconnectMono.java From rsocket-java with Apache License 2.0 | 6 votes |
@Override public void onError(Throwable t) { final Subscription s = this.s; if (s == Operators.cancelledSubscription() || S.getAndSet(this, Operators.cancelledSubscription()) == Operators.cancelledSubscription()) { this.doFinally(); Operators.onErrorDropped(t, Context.empty()); return; } this.doFinally(); // terminate upstream which means retryBackoff has exhausted this.parent.terminate(t); }
Example 5
Source File: MonoSendMany.java From reactor-netty with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (terminalSignal != null) { Operators.onErrorDropped(t, actual.currentContext()); return; } if (t instanceof ClosedChannelException) { t = new AbortedException(t); } terminalSignal = t; trySchedule(null); }
Example 6
Source File: ResolvingOperator.java From rsocket-java with Apache License 2.0 | 5 votes |
@Override public final void onError(Throwable t) { if (this.done) { Operators.onErrorDropped(t, this.actual.currentContext()); return; } this.done = true; this.actual.onError(t); }
Example 7
Source File: RequestOperator.java From rsocket-java with Apache License 2.0 | 5 votes |
@Override public void onComplete() { this.actual.onComplete(); try { this.hookOnTerminal(SignalType.ON_COMPLETE); } catch (Throwable throwable) { Operators.onErrorDropped(throwable, currentContext()); } }
Example 8
Source File: RequestOperator.java From rsocket-java with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { this.actual.onError(t); try { this.hookOnTerminal(SignalType.ON_ERROR); } catch (Throwable throwable) { Operators.onErrorDropped(throwable, currentContext()); } }
Example 9
Source File: DefaultRSocketClient.java From rsocket-java with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (this.done) { Operators.onErrorDropped(t, this.actual.currentContext()); return; } this.done = true; this.actual.onError(t); }
Example 10
Source File: UnboundedProcessor.java From rsocket-java with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (done || cancelled) { Operators.onErrorDropped(t, currentContext()); return; } error = t; done = true; drain(); }
Example 11
Source File: MonoSendMany.java From reactor-netty with Apache License 2.0 | 5 votes |
@Override public ChannelPromise setFailure(Throwable cause) { if (tryFailure(cause)) { return this; } Operators.onErrorDropped(cause, actual.currentContext()); return this; }
Example 12
Source File: DiscardOnCancelSubscriber.java From r2dbc-mysql with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (compareAndSet(0, TERMINATED)) { this.actual.onError(t); } else { Operators.onErrorDropped(t, this.ctx); } }
Example 13
Source File: ResultFlux.java From retrofit2-reactor-adapter with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable throwable) { try { subscriber.onNext(Result.error(throwable)); } catch (Throwable t) { try { subscriber.onError(t); } catch (Throwable inner) { Operators.onErrorDropped(inner, Context.empty()); } return; } subscriber.onComplete(); }
Example 14
Source File: BodyFlux.java From retrofit2-reactor-adapter with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable throwable) { if (!subscriberTerminated) { subscriber.onError(throwable); } else { // This should never happen! onNext handles and forwards errors automatically. Throwable broken = new AssertionError( "This should never happen! Report as a Retrofit bug with the full stacktrace.", throwable); Operators.onErrorDropped(broken, Context.empty()); } }
Example 15
Source File: BodyFlux.java From retrofit2-reactor-adapter with Apache License 2.0 | 5 votes |
@Override public void onNext(Response<R> response) { if (response.isSuccessful()) { subscriber.onNext(response.body()); } else { subscriberTerminated = true; Throwable t = new HttpException(response); try { subscriber.onError(t); } catch (Throwable inner) { Operators.onErrorDropped(inner, Context.empty()); } } }
Example 16
Source File: InheritableBaseSubscriber.java From Sentinel with Apache License 2.0 | 5 votes |
void safeHookFinally(SignalType type) { try { hookFinally(type); } catch (Throwable finallyFailure) { Operators.onErrorDropped(finallyFailure, currentContext()); } }
Example 17
Source File: InheritableBaseSubscriber.java From Sentinel with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { Objects.requireNonNull(t, "onError"); if (S.getAndSet(this, Operators.cancelledSubscription()) == Operators .cancelledSubscription()) { // Already cancelled concurrently // Workaround for Sentinel BlockException: // Here we add a predicate method to decide whether exception should be dropped implicitly // or call the {@code onErrorDropped} hook. if (shouldCallErrorDropHook()) { Operators.onErrorDropped(t, currentContext()); } return; } try { hookOnError(t); } catch (Throwable e) { e = Exceptions.addSuppressed(e, t); Operators.onErrorDropped(e, currentContext()); } finally { safeHookFinally(SignalType.ON_ERROR); } }
Example 18
Source File: ResolvingOperator.java From rsocket-java with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { if (isCancelled()) { Operators.onErrorDropped(t, currentContext()); } else { this.actual.onError(t); } }
Example 19
Source File: InheritableBaseSubscriber.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
void safeHookFinally(SignalType type) { try { hookFinally(type); } catch (Throwable finallyFailure) { Operators.onErrorDropped(finallyFailure, currentContext()); } }
Example 20
Source File: InheritableBaseSubscriber.java From Sentinel-Dashboard-Nacos with Apache License 2.0 | 5 votes |
@Override public void onError(Throwable t) { Objects.requireNonNull(t, "onError"); if (S.getAndSet(this, Operators.cancelledSubscription()) == Operators .cancelledSubscription()) { // Already cancelled concurrently // Workaround for Sentinel BlockException: // Here we add a predicate method to decide whether exception should be dropped implicitly // or call the {@code onErrorDropped} hook. if (shouldCallErrorDropHook()) { Operators.onErrorDropped(t, currentContext()); } return; } try { hookOnError(t); } catch (Throwable e) { e = Exceptions.addSuppressed(e, t); Operators.onErrorDropped(e, currentContext()); } finally { safeHookFinally(SignalType.ON_ERROR); } }