Do not use toString() in looging messages
[netconf.git] / netconf / netconf-impl / src / main / java / org / opendaylight / netconf / impl / NetconfServerSession.java
index dc314c05e0fe49a198ce33cce94925faa305af44..a08f52d1caccb7c3acc3d65b3e41e7f7321a9eaf 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.net.InetAddresses;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
-import io.netty.channel.ChannelFutureListener;
 import io.netty.handler.codec.ByteToMessageDecoder;
 import io.netty.handler.codec.MessageToByteEncoder;
 import java.net.Inet4Address;
@@ -70,7 +69,7 @@ public final class NetconfServerSession extends AbstractNetconfSession<NetconfSe
         super(sessionListener, channel, sessionId);
         this.header = header;
         this.sessionListener = sessionListener;
-        LOG.debug("Session {} created", toString());
+        LOG.debug("Session {} created", this);
     }
 
     @Override
@@ -97,12 +96,7 @@ public final class NetconfServerSession extends AbstractNetconfSession<NetconfSe
         }
         // delayed close was set, close after the message was sent
         if (delayedClose) {
-            channelFuture.addListener(new ChannelFutureListener() {
-                @Override
-                public void operationComplete(final ChannelFuture future) throws Exception {
-                    close();
-                }
-            });
+            channelFuture.addListener(future -> close());
         }
         return channelFuture;
     }
@@ -150,7 +144,7 @@ public final class NetconfServerSession extends AbstractNetconfSession<NetconfSe
 
         builder.setOutNotifications(new ZeroBasedCounter32(outNotification));
 
-        builder.setKey(new SessionKey(getSessionId()));
+        builder.withKey(new SessionKey(getSessionId()));
 
         Session1Builder builder1 = new Session1Builder();
         builder1.setSessionIdentifier(header.getSessionIdentifier());