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);
}
Aggregations