Use a simple future 63/102763/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 31 May 2022 20:30:11 +0000 (22:30 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 19 Oct 2022 22:51:53 +0000 (00:51 +0200)
Channel is an invariant, hence we do not need to dereference
ChannelFuture, allowing us to reduce verbosity quite a bit.

Change-Id: Ifa9b9b89e1841479f3e66141e02b2619492f3900
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit bebb527a997ac93766c4639c9ee04c2ac7b2995b)

netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index 68fddfc74c6677eff605b2d4913fb2741bab72fb..053540c758e9122ec7b302b653597145eac45d4c 100644 (file)
@@ -13,14 +13,12 @@ import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
 import io.netty.channel.Channel;
-import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.handler.ssl.SslHandler;
 import io.netty.util.Timeout;
 import io.netty.util.Timer;
-import io.netty.util.concurrent.GenericFutureListener;
 import io.netty.util.concurrent.Promise;
 import java.util.concurrent.TimeUnit;
 import org.checkerframework.checker.index.qual.NonNegative;
@@ -181,11 +179,11 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
                     connectionTimeoutMillis);
                 changeState(State.FAILED);
 
-                channel.close().addListener((GenericFutureListener<ChannelFuture>) future -> {
+                channel.close().addListener(future -> {
                     if (future.isSuccess()) {
-                        LOG.debug("Channel {} closed: success", future.channel());
+                        LOG.debug("Channel {} closed: success", channel);
                     } else {
-                        LOG.warn("Channel {} closed: fail", future.channel());
+                        LOG.warn("Channel {} closed: fail", channel);
                     }
                 });
             }