Use a simple future 85/101385/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 31 May 2022 20:30:11 +0000 (22:30 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 31 May 2022 20:47:45 +0000 (22:47 +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>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index 9a9225b247f0c53ead8c1000e38d06561e7ccb1d..ee98febb6d6a587d4f6fb0690295821fcbabeffc 100644 (file)
@@ -11,14 +11,12 @@ import static com.google.common.base.Preconditions.checkState;
 import static java.util.Objects.requireNonNull;
 
 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.Optional;
 import java.util.concurrent.TimeUnit;
@@ -134,11 +132,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);
                     }
                 });
             }