X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fimpl%2FNetconfServerSession.java;h=a08f52d1caccb7c3acc3d65b3e41e7f7321a9eaf;hb=4e5846ad7c1f8bf452fa89e0f9409ac648fccd90;hp=d023be2f0d41a8a751529a762ff170e29d3c3d8f;hpb=ec860b9f946515a6a16659b23eb7dec1a8d89624;p=netconf.git diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSession.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSession.java index d023be2f0d..a08f52d1ca 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSession.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSession.java @@ -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; @@ -47,24 +46,30 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types. import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public final class NetconfServerSession extends AbstractNetconfSession implements NetconfManagementSession { +public final class NetconfServerSession extends AbstractNetconfSession implements NetconfManagementSession { private static final Logger LOG = LoggerFactory.getLogger(NetconfServerSession.class); - private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ISO_OFFSET_DATE_TIME; + private static final String DATE_TIME_PATTERN_STRING = DateAndTime.PATTERN_CONSTANTS.get(0); + private static final Pattern DATE_TIME_PATTERN = Pattern.compile(DATE_TIME_PATTERN_STRING); private final NetconfHelloMessageAdditionalHeader header; private final NetconfServerSessionListener sessionListener; private ZonedDateTime loginTime; - private long inRpcSuccess, inRpcFail, outRpcError, outNotification; + private long inRpcSuccess; + private long inRpcFail; + private long outRpcError; + private long outNotification; private volatile boolean delayedClose; - public NetconfServerSession(final NetconfServerSessionListener sessionListener, final Channel channel, final long sessionId, - final NetconfHelloMessageAdditionalHeader header) { + public NetconfServerSession(final NetconfServerSessionListener sessionListener, final Channel channel, + final long sessionId, final NetconfHelloMessageAdditionalHeader header) { super(sessionListener, channel, sessionId); this.header = header; this.sessionListener = sessionListener; - LOG.debug("Session {} created", toString()); + LOG.debug("Session {} created", this); } @Override @@ -90,13 +95,8 @@ public final class NetconfServerSession extends AbstractNetconfSession close()); } return channelFuture; } @@ -113,9 +113,6 @@ public final class NetconfServerSession extends AbstractNetconfSession getTransportForString(final String transport) { - switch(transport) { - case "ssh" : - return NetconfSsh.class; - case "tcp" : - return NetconfTcp.class; - default: - throw new IllegalArgumentException("Unknown transport type " + transport); + switch (transport) { + case "ssh": + return NetconfSsh.class; + case "tcp": + return NetconfTcp.class; + default: + throw new IllegalArgumentException("Unknown transport type " + transport); } } @@ -172,7 +170,8 @@ public final class NetconfServerSession extends AbstractNetconfSession encoder) { + protected void addExiHandlers(final ByteToMessageDecoder decoder, + final MessageToByteEncoder encoder) { replaceMessageDecoder(decoder); replaceMessageEncoderAfterNextMessage(encoder); }