Search in sources :

Example 1 with WriteObserver

use of io.servicetalk.transport.api.ConnectionObserver.WriteObserver in project servicetalk by apple.

the class DefaultNettyConnection method write.

@Override
public Completable write(final Publisher<Write> write, final Supplier<FlushStrategy> flushStrategySupplier, final Supplier<WriteDemandEstimator> demandEstimatorSupplier) {
    return cleanupStateWhenDone(new SubscribableCompletable() {

        @Override
        protected void handleSubscribe(Subscriber completableSubscriber) {
            final WriteObserver writeObserver = DefaultNettyConnection.this.dataObserver.onNewWrite();
            WriteStreamSubscriber subscriber = new WriteStreamSubscriber(channel(), demandEstimatorSupplier.get(), completableSubscriber, closeHandler, writeObserver, enrichProtocolError, isClient, shouldWait);
            if (failIfWriteActive(subscriber, completableSubscriber)) {
                toSource(composeFlushes(channel(), write, flushStrategySupplier.get(), writeObserver)).subscribe(subscriber);
            }
        }
    }).onErrorMap(this::enrichError);
}
Also used : Subscriber(io.servicetalk.concurrent.CompletableSource.Subscriber) SubscribableCompletable(io.servicetalk.concurrent.api.internal.SubscribableCompletable) WriteObserver(io.servicetalk.transport.api.ConnectionObserver.WriteObserver)

Aggregations

Subscriber (io.servicetalk.concurrent.CompletableSource.Subscriber)1 SubscribableCompletable (io.servicetalk.concurrent.api.internal.SubscribableCompletable)1 WriteObserver (io.servicetalk.transport.api.ConnectionObserver.WriteObserver)1