/** * Sub-classes can call this to delegate container error notifications. */ public final void onError(Throwable ex) { if (rsReadLogger.isTraceEnabled()) { rsReadLogger.trace(getLogPrefix() + "Connection error: " + ex); } this.state.get().onError(this, ex); }
@Override <T> void subscribe(AbstractListenerReadPublisher<T> publisher, Subscriber<? super T> subscriber) { Assert.notNull(publisher, "Publisher must not be null"); Assert.notNull(subscriber, "Subscriber must not be null"); if (publisher.changeState(this, SUBSCRIBING)) { Subscription subscription = publisher.createSubscription(); publisher.subscriber = subscriber; subscriber.onSubscribe(subscription); publisher.changeState(SUBSCRIBING, NO_DEMAND); // Now safe to check "beforeDemand" flags, they won't change once in NO_DEMAND String logPrefix = publisher.getLogPrefix(); if (publisher.completionBeforeDemand) { rsReadLogger.trace(logPrefix + "Completed before demand"); publisher.state.get().onAllDataRead(publisher); } Throwable ex = publisher.errorBeforeDemand; if (ex != null) { if (rsReadLogger.isTraceEnabled()) { rsReadLogger.trace(logPrefix + "Completed with error before demand: " + ex); } publisher.state.get().onError(publisher, ex); } } else { throw new IllegalStateException("Failed to transition to SUBSCRIBING, " + "subscriber: " + subscriber); } }
/** * Sub-classes can call this to delegate container error notifications. */ public final void onError(Throwable ex) { if (rsReadLogger.isTraceEnabled()) { rsReadLogger.trace(getLogPrefix() + "Connection error: " + ex); } this.state.get().onError(this, ex); }
@Override <T> void subscribe(AbstractListenerReadPublisher<T> publisher, Subscriber<? super T> subscriber) { Assert.notNull(publisher, "Publisher must not be null"); Assert.notNull(subscriber, "Subscriber must not be null"); if (publisher.changeState(this, SUBSCRIBING)) { Subscription subscription = publisher.createSubscription(); publisher.subscriber = subscriber; subscriber.onSubscribe(subscription); publisher.changeState(SUBSCRIBING, NO_DEMAND); // Now safe to check "beforeDemand" flags, they won't change once in NO_DEMAND String logPrefix = publisher.getLogPrefix(); if (publisher.completionBeforeDemand) { rsReadLogger.trace(logPrefix + "Completed before demand"); publisher.state.get().onAllDataRead(publisher); } Throwable ex = publisher.errorBeforeDemand; if (ex != null) { if (rsReadLogger.isTraceEnabled()) { rsReadLogger.trace(logPrefix + "Completed with error before demand: " + ex); } publisher.state.get().onError(publisher, ex); } } else { throw new IllegalStateException("Failed to transition to SUBSCRIBING, " + "subscriber: " + subscriber); } }
@Override <T> void subscribe(AbstractListenerReadPublisher<T> publisher, Subscriber<? super T> subscriber) { Assert.notNull(publisher, "Publisher must not be null"); Assert.notNull(subscriber, "Subscriber must not be null"); if (publisher.changeState(this, SUBSCRIBING)) { Subscription subscription = publisher.createSubscription(); publisher.subscriber = subscriber; subscriber.onSubscribe(subscription); publisher.changeState(SUBSCRIBING, NO_DEMAND); // Now safe to check "beforeDemand" flags, they won't change once in NO_DEMAND if (publisher.completionBeforeDemand) { publisher.logger.trace("Completed before demand"); publisher.state.get().onAllDataRead(publisher); } Throwable ex = publisher.errorBeforeDemand; if (ex != null) { if (publisher.logger.isTraceEnabled()) { publisher.logger.trace("Completed with error before demand: " + ex); } publisher.state.get().onError(publisher, ex); } } else { throw new IllegalStateException("Failed to transition to SUBSCRIBING, " + "subscriber: " + subscriber); } }
<T> void onError(AbstractListenerReadPublisher<T> publisher, Throwable t) { if (publisher.changeState(this, COMPLETED)) { publisher.discardData(); Subscriber<? super T> s = publisher.subscriber; if (s != null) { s.onError(t); } } else { publisher.state.get().onError(publisher, t); } } }
/** * Sub-classes can call this to delegate container error notifications. */ public final void onError(Throwable ex) { if (this.logger.isTraceEnabled()) { this.logger.trace("I/O event onError: " + ex); } this.state.get().onError(this, ex); }
/** * Sub-classes can call this to delegate container error notifications. */ public final void onError(Throwable ex) { if (rsReadLogger.isTraceEnabled()) { rsReadLogger.trace(getLogPrefix() + "Connection error: " + ex); } this.state.get().onError(this, ex); }
@Override <T> void subscribe(AbstractListenerReadPublisher<T> publisher, Subscriber<? super T> subscriber) { Assert.notNull(publisher, "Publisher must not be null"); Assert.notNull(subscriber, "Subscriber must not be null"); if (publisher.changeState(this, SUBSCRIBING)) { Subscription subscription = publisher.createSubscription(); publisher.subscriber = subscriber; subscriber.onSubscribe(subscription); publisher.changeState(SUBSCRIBING, NO_DEMAND); // Now safe to check "beforeDemand" flags, they won't change once in NO_DEMAND String logPrefix = publisher.getLogPrefix(); if (publisher.completionBeforeDemand) { rsReadLogger.trace(logPrefix + "Completed before demand"); publisher.state.get().onAllDataRead(publisher); } Throwable ex = publisher.errorBeforeDemand; if (ex != null) { if (rsReadLogger.isTraceEnabled()) { rsReadLogger.trace(logPrefix + "Completed with error before demand: " + ex); } publisher.state.get().onError(publisher, ex); } } else { throw new IllegalStateException("Failed to transition to SUBSCRIBING, " + "subscriber: " + subscriber); } }
<T> void onError(AbstractListenerReadPublisher<T> publisher, Throwable t) { if (publisher.changeState(this, COMPLETED)) { publisher.discardData(); Subscriber<? super T> s = publisher.subscriber; if (s != null) { s.onError(t); } } else { publisher.state.get().onError(publisher, t); } } }
<T> void onError(AbstractListenerReadPublisher<T> publisher, Throwable t) { if (publisher.changeState(this, COMPLETED)) { publisher.discardData(); Subscriber<? super T> s = publisher.subscriber; if (s != null) { s.onError(t); } } else { publisher.state.get().onError(publisher, t); } } }