X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2Fhandler%2Fssh%2Fclient%2FAsyncSshHandlerWriter.java;h=d13d45a238fcf2f618069ea3ea945bee72e1faef;hb=a80dddbb6eed5e87a4aa4917ce35c6ed94a53087;hp=3477b0b9249b035ee5a85883eb281d83172e67a2;hpb=ff4374a839351458ef1598827ce34363f35efea2;p=netconf.git diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java index 3477b0b924..d13d45a238 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java @@ -16,7 +16,6 @@ import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Deque; import java.util.LinkedList; -import java.util.Queue; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.checkerframework.checker.lock.qual.GuardedBy; @@ -171,12 +170,18 @@ public final class AsyncSshHandlerWriter implements AutoCloseable { } private void queueRequest(final ChannelHandlerContext ctx, final ByteBuf msg, final ChannelPromise promise) { -// try { LOG.debug("Write pending on channel: {}, queueing, current queue size: {}", ctx.channel(), pending.size()); if (LOG.isTraceEnabled()) { LOG.trace("Queueing request due to pending: {}", byteBufToString(msg)); } - new PendingWriteRequest(ctx, msg, promise).pend(pending); + +// try { + final var req = new PendingWriteRequest(ctx, msg, promise); + // Preconditions.checkState(pending.size() < MAX_PENDING_WRITES, + // "Too much pending writes(%s) on channel: %s, remote window is not getting read or is too small", + // pending.size(), ctx.channel()); + checkState(pending.offer(req), "Cannot pend another request write (pending count: %s) on channel: %s", + pending.size(), ctx.channel()); // } catch (final Exception ex) { // LOG.warn("Unable to queue write request on channel: {}. Setting fail for the request: {}", // ctx.channel(), ex, byteBufToString(msg)); @@ -210,13 +215,5 @@ public final class AsyncSshHandlerWriter implements AutoCloseable { this.msg = msg; this.promise = promise; } - - void pend(final Queue pending) { - // Preconditions.checkState(pending.size() < MAX_PENDING_WRITES, - // "Too much pending writes(%s) on channel: %s, remote window is not getting read or is too small", - // pending.size(), ctx.channel()); - checkState(pending.offer(this), "Cannot pend another request write (pending count: %s) on channel: %s", - pending.size(), ctx.channel()); - } } }