From 0186064d75d66339db5392b0a9f8b2af22c515cd Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 18 Feb 2014 11:39:14 +0100 Subject: [PATCH] Introduce checked sendMessage() method This method send a message down the socket and makes sure that negotiation fails if the message does not reach the peer for any reason. Subclasses should use this method instead of talking directly to the underlying channel. Change-Id: I5b8201caef1c4ba655dad12fb139b054b9e75f06 Signed-off-by: Robert Varga --- .../framework/AbstractSessionNegotiator.java | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java index 9f9f811e88..d41e8106c5 100644 --- a/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java +++ b/opendaylight/commons/protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java @@ -8,6 +8,8 @@ package org.opendaylight.protocol.framework; import io.netty.channel.Channel; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.util.concurrent.Promise; @@ -26,7 +28,7 @@ import com.google.common.base.Preconditions; * @param Protocol session type, has to extend ProtocolSession */ public abstract class AbstractSessionNegotiator> extends ChannelInboundHandlerAdapter implements SessionNegotiator { - private final Logger logger = LoggerFactory.getLogger(AbstractSessionNegotiator.class); + private final Logger LOG = LoggerFactory.getLogger(AbstractSessionNegotiator.class); private final Promise promise; protected final Channel channel; @@ -39,42 +41,63 @@ public abstract class AbstractSessionNegotiator