X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=bgp%2Frib-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FChannelOutputLimiter.java;h=ca818341b734b38a1c289e15403d61544fefb640;hb=refs%2Fheads%2Fstable%2Fboron;hp=bf1d253ef66ab4be6a2f4583764eae06d129e62b;hpb=2dbddbd4f50dca562f9d2d5078baa2c485bced92;p=bgpcep.git diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ChannelOutputLimiter.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ChannelOutputLimiter.java index bf1d253ef6..ca818341b7 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ChannelOutputLimiter.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ChannelOutputLimiter.java @@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory; * for a sessions' channel. */ @ThreadSafe -final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { +public final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { private static final Logger LOG = LoggerFactory.getLogger(ChannelOutputLimiter.class); private final BGPSessionImpl session; private volatile boolean blocked; @@ -37,6 +37,7 @@ final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { while (this.blocked) { try { LOG.debug("Waiting for session {} to become writable", this.session); + flush(); this.wait(); } catch (final InterruptedException e) { throw new IllegalStateException("Interrupted while waiting for channel to come back", e); @@ -48,7 +49,7 @@ final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { } } - void write(final Notification msg) { + public void write(final Notification msg) { ensureWritable(); this.session.write(msg); } @@ -58,7 +59,7 @@ final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { return this.session.writeAndFlush(msg); } - void flush() { + public void flush() { this.session.flush(); } @@ -71,9 +72,7 @@ final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { LOG.debug("Writes on session {} {}", this.session, w ? "unblocked" : "blocked"); if (w) { - this.notifyAll(); - } else { - flush(); + notifyAll(); } } @@ -84,7 +83,7 @@ final class ChannelOutputLimiter extends ChannelInboundHandlerAdapter { public void channelInactive(final ChannelHandlerContext ctx) throws Exception { synchronized (this) { this.blocked = false; - this.notifyAll(); + notifyAll(); } super.channelInactive(ctx);