@Override public FluxSink<T> next(T t) { Objects.requireNonNull(t, "t is null in sink.next(t)"); if (sink.isCancelled() || done) { Operators.onNextDropped(t, sink.currentContext()); return this; } if (WIP.get(this) == 0 && WIP.compareAndSet(this, 0, 1)) { try { sink.next(t); } catch (Throwable ex) { Operators.onOperatorError(sink, ex, t, sink.currentContext()); } if (WIP.decrementAndGet(this) == 0) { return this; } } else { this.mpscQueue.offer(t); if (WIP.getAndIncrement(this) != 0) { return this; } } drainLoop(); return this; }
@Override public void error(Throwable t) { Objects.requireNonNull(t, "t is null in sink.error(t)"); if (sink.isCancelled() || done) { Operators.onOperatorError(t, sink.currentContext()); return; } if (Exceptions.addThrowable(ERROR, this, t)) { done = true; drain(); } else { Operators.onOperatorError(t, sink.currentContext()); } }
void drainLoop() { Context ctx = sink.currentContext(); BaseSink<T> e = sink; Queue<T> q = mpscQueue; Operators.onOperatorError(sink, ex, v, sink.currentContext());
void drainLoop() { Context ctx = sink.currentContext(); BaseSink<T> e = sink; Queue<T> q = mpscQueue; Operators.onOperatorError(sink, ex, v, sink.currentContext());
@Override public FluxSink<T> next(T t) { Objects.requireNonNull(t, "t is null in sink.next(t)"); if (sink.isCancelled() || done) { Operators.onNextDropped(t, sink.currentContext()); return this; } if (WIP.get(this) == 0 && WIP.compareAndSet(this, 0, 1)) { try { sink.next(t); } catch (Throwable ex) { Operators.onOperatorError(sink, ex, t, sink.currentContext()); } if (WIP.decrementAndGet(this) == 0) { return this; } } else { this.mpscQueue.offer(t); if (WIP.getAndIncrement(this) != 0) { return this; } } drainLoop(); return this; }
@Override public void error(Throwable t) { Objects.requireNonNull(t, "t is null in sink.error(t)"); if (sink.isCancelled() || done) { Operators.onOperatorError(t, sink.currentContext()); return; } if (Exceptions.addThrowable(ERROR, this, t)) { done = true; drain(); } else { Operators.onOperatorError(t, sink.currentContext()); } }
@Override public Context currentContext() { return sink.currentContext(); }
@Override public Context currentContext() { return sink.currentContext(); }