@Override protected void doRequest(long n) { if (BackpressureUtils.getAndAdd(PENDING_UPDATER, this, n) == 0) { super.doRequest(n); if (!tryDrain()) { requestMissing(); } } else if (terminated == 1) { if (tryDrain() && TERMINATED.compareAndSet(this, 1, 2)) { super.doComplete(); } } }
@Override protected void doCancel() { if (cancelConsumer != null) { cancelConsumer.accept(null); } super.doCancel(); }
@Override protected void doError(Throwable throwable) { if (TERMINATED.compareAndSet(this, 0, 1)) { tryDrain(); super.doError(throwable); } }
@Override protected void doOnSubscribe(Subscription subscription) { if ((options & ON_SUBSCRIBE) == ON_SUBSCRIBE && log.isInfoEnabled()) { log.info("⇩ " + concatId() + "onSubscribe({})", this.subscription); } super.doOnSubscribe(subscription); }
@Override protected void doCancel() { if ((options & CANCEL) == CANCEL && log.isInfoEnabled()) { log.info("↥ " + concatId() + "cancel()"); } super.doCancel(); }
@Override protected void doRequest(long n) { if ((options & REQUEST) == REQUEST && log.isInfoEnabled()) { log.info("⇡ " + concatId() + "request({})", Long.MAX_VALUE == n ? "unbounded" : n); } super.doRequest(n); }
@Override protected void doComplete() { if ((options & ON_COMPLETE) == ON_COMPLETE && log.isInfoEnabled()) { log.info("↧ " + concatId() + "onComplete()"); } super.doComplete(); }
@Override protected void doError(Throwable throwable) { if ((options & ON_ERROR) == ON_ERROR && log.isErrorEnabled()) { log.error("↯ " + concatId() + "onError({})", throwable); } super.doError(throwable); }
@Override protected void doNext(IN in) { if ((options & ON_NEXT) == ON_NEXT && log.isInfoEnabled()) { log.info("↓ " + concatId() + "onNext({})", in); } super.doNext(in); }
@Override protected void doComplete() { if (TERMINATED.compareAndSet(this, 0, 1)) { if (tryDrain()) { super.doComplete(); } } }
private void requestMissing() { if (pendingDemand != Long.MAX_VALUE) { super.doRequest(1L); } }