X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-netty-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fnettyutil%2FAbstractNetconfSessionNegotiator.java;h=d9c15ae03578052a079bc157d44d2e7e9dcb6e1e;hb=ce8ad4e92f8128750f7ce7216f7e73ad238efaae;hp=4135896b34d28361a4a9fd6f19d6e09864fccdcc;hpb=61b5bba1c5f1be19252f65f67c43a6e9ba33feb3;p=netconf.git diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java index 4135896b34..d9c15ae035 100644 --- a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java +++ b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiator.java @@ -19,7 +19,6 @@ import io.netty.handler.ssl.SslHandler; import io.netty.util.Timeout; import io.netty.util.Timer; import io.netty.util.TimerTask; -import io.netty.util.concurrent.Future; import io.netty.util.concurrent.GenericFutureListener; import io.netty.util.concurrent.Promise; import java.util.concurrent.TimeUnit; @@ -84,14 +83,10 @@ public abstract class AbstractNetconfSessionNegotiator

sslHandler = getSslHandler(channel); if (sslHandler.isPresent()) { - Future future = sslHandler.get().handshakeFuture(); - future.addListener(new GenericFutureListener>() { - @Override - public void operationComplete(final Future future) { - Preconditions.checkState(future.isSuccess(), "Ssl handshake was not successful"); - LOG.debug("Ssl handshake complete"); - start(); - } + sslHandler.get().handshakeFuture().addListener(future -> { + Preconditions.checkState(future.isSuccess(), "Ssl handshake was not successful"); + LOG.debug("Ssl handshake complete"); + start(); }); } else { start(); @@ -106,7 +101,7 @@ public abstract class AbstractNetconfSessionNegotiator

getSslHandler(final Channel channel) { final SslHandler sslHandler = channel.pipeline().get(SslHandler.class); - return sslHandler == null ? Optional.absent() : Optional.of(sslHandler); + return sslHandler == null ? Optional.absent() : Optional.of(sslHandler); } public P getSessionPreferences() { @@ -139,14 +134,11 @@ public abstract class AbstractNetconfSessionNegotiator

() { - @Override - public void operationComplete(final ChannelFuture future) throws Exception { - if (future.isSuccess()) { - LOG.debug("Channel {} closed: success", future.channel()); - } else { - LOG.warn("Channel {} closed: fail", future.channel()); - } + channel.close().addListener((GenericFutureListener) future -> { + if (future.isSuccess()) { + LOG.debug("Channel {} closed: success", future.channel()); + } else { + LOG.warn("Channel {} closed: fail", future.channel()); } }); }