@Override public void onNext(T t) { synchronized (this) { C b = buffer; if (b != null) { b.add(t); return; } } Operators.onNextDropped(t, this.ctx); }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, context); return; } value = t; done = true; drain(); }
@Override public void onNext(T t) { Objects.requireNonNull(t, "t"); DirectInner<T>[] inners = subscribers; if (inners == TERMINATED) { Operators.onNextDropped(t, currentContext()); return; } for (DirectInner<T> s : inners) { s.onNext(t); } }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, actual.currentContext()); return; } synchronized (this) { queue.offer(t); } drain(); }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, parent.currentContext()); return; } done = true; this.parent.complete(t); }
@Override public void onNext(T ev) { if(terminalSignal != null){ Operators.onNextDropped(ev, this.cachedContext); return; } produced++; actual.onNext(Signal.next(ev, this.cachedContext)); }
@Override public void onNext(R t) { if (done) { Operators.onNextDropped(t, parent.currentContext()); return; } done = true; this.parent.complete(t); }
@Override public void onNext(T t) { Subscription s = ref.getAndSet(null); if (s != null) { complete(t); s.cancel(); } else { Operators.onNextDropped(t, currentContext()); } }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, actual.currentContext()); return; } value = t; if (++count > 1) { cancel(); onError(new IndexOutOfBoundsException("Source emitted more than one item")); } }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, parent.currentContext()); return; } done = true; Operators.terminate(S, this); parent.next(t, index); }
@Override public void onNext(T t) { if (done) { this.malformedSourceCounter.increment(); Operators.onNextDropped(t, actual.currentContext()); return; } actual.onNext(t); }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, actual.currentContext()); return; } try { accumulator.accept(container, t); } catch (Throwable ex) { onError(Operators.onOperatorError(s, ex, t, actual.currentContext())); } }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, actual.currentContext()); return; } try { action.accept(value, t); } catch (Throwable e) { onError(Operators.onOperatorError(this, e, t, actual.currentContext())); } }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, actual.currentContext()); return; } try { collector.accept(collection, t); } catch (Throwable ex) { onError(Operators.onOperatorError(this, ex, t, actual.currentContext())); } }
@Test public void onNextDroppedLocal() { AtomicReference<Object> hookState = new AtomicReference<>(); Consumer<Object> localHook = hookState::set; Context c = Context.of(Hooks.KEY_ON_NEXT_DROPPED, localHook); Operators.onNextDropped("foo", c); assertThat(hookState.get()).isEqualTo("foo"); }
@Override public void onNext(T t) { if (done) { Operators.onNextDropped(t, actual.currentContext()); return; } s.cancel(); actual.onNext(t); onComplete(); }
@Override public void onNext(final T t) { if (done || delayed < 0) { Operators.onNextDropped(t, currentContext()); return; } //keep track of the number of delayed onNext so that //we can also delay onError/onComplete when an onNext //is "in flight" DELAYED.incrementAndGet(this); w.schedule(() -> delayedNext(t), delay, timeUnit); }
@Override public void onNext(T t) { ReplayBuffer<T> b = buffer; if (b.isDone()) { Operators.onNextDropped(t, currentContext()); } else { b.add(t); for (ReplaySubscription<T> rs : subscribers) { b.replay(rs); } } }
@Override public void onNext(T t) { if (done) { this.malformedSourceCounter.increment(); Operators.onNextDropped(t, actual.currentContext()); return; } //record the delay since previous onNext/onSubscribe. This also records the count. long last = this.lastNextEventNanos; this.lastNextEventNanos = clock.monotonicTime(); this.onNextIntervalTimer.record(lastNextEventNanos - last, TimeUnit.NANOSECONDS); actual.onNext(t); }
/** * Helper for other tests to emulate resumeDrop with the public consumer-based API. */ public static <T> void drop(@Nullable Throwable e, @Nullable T v) { if (v != null) { Operators.onNextDropped(v, Context.empty()); } if (e != null) { Operators.onErrorDropped(e, Context.empty()); } }