X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FNetconfServerSessionListener.java;h=951d0dd98d7d2b52bb13e6fc21a8f88673c74de6;hb=e5af39cc8b49e7e0169980c9e4b8017f7d481d48;hp=b3245fff2b812775803acf59e1c2e53aa875d77e;hpb=9c9d6e69da3aff2d0576d8c15ea0fa0692595b6d;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java index b3245fff2b..951d0dd98d 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionListener.java @@ -9,16 +9,18 @@ package org.opendaylight.controller.netconf.impl; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouter; import org.opendaylight.controller.netconf.api.NetconfSessionListener; import org.opendaylight.controller.netconf.api.NetconfTerminationReason; +import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.impl.mapping.operations.DefaultCloseSession; +import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouter; import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService; import org.opendaylight.controller.netconf.util.messages.SendErrorExceptionUtil; import org.opendaylight.controller.netconf.util.xml.XmlElement; -import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,59 +28,56 @@ import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; - public class NetconfServerSessionListener implements NetconfSessionListener { - static final Logger logger = LoggerFactory.getLogger(NetconfServerSessionListener.class); + private static final Logger LOG = LoggerFactory.getLogger(NetconfServerSessionListener.class); private final SessionMonitoringService monitoringService; private final NetconfOperationRouter operationRouter; private final AutoCloseable onSessionDownCloseable; - public NetconfServerSessionListener(NetconfOperationRouter operationRouter, SessionMonitoringService monitoringService, - AutoCloseable onSessionDownCloseable) { + public NetconfServerSessionListener(final NetconfOperationRouter operationRouter, final SessionMonitoringService monitoringService, + final AutoCloseable onSessionDownCloseable) { this.operationRouter = operationRouter; this.monitoringService = monitoringService; this.onSessionDownCloseable = onSessionDownCloseable; } @Override - public void onSessionUp(NetconfServerSession netconfNetconfServerSession) { + public void onSessionUp(final NetconfServerSession netconfNetconfServerSession) { monitoringService.onSessionUp(netconfNetconfServerSession); } @Override - public void onSessionDown(NetconfServerSession netconfNetconfServerSession, Exception cause) { - logger.debug("Session {} down, reason: {}", netconfNetconfServerSession, cause.getMessage()); + public void onSessionDown(final NetconfServerSession netconfNetconfServerSession, final Exception cause) { + LOG.debug("Session {} down, reason: {}", netconfNetconfServerSession, cause.getMessage()); onDown(netconfNetconfServerSession); } - public void onDown(NetconfServerSession netconfNetconfServerSession) { + public void onDown(final NetconfServerSession netconfNetconfServerSession) { monitoringService.onSessionDown(netconfNetconfServerSession); try { operationRouter.close(); } catch (Exception closingEx) { - logger.debug("Ignoring exception while closing operationRouter", closingEx); + LOG.debug("Ignoring exception while closing operationRouter", closingEx); } try { onSessionDownCloseable.close(); } catch(Exception ex){ - logger.debug("Ignoring exception while closing onSessionDownCloseable", ex); + LOG.debug("Ignoring exception while closing onSessionDownCloseable", ex); } } @Override - public void onSessionTerminated(NetconfServerSession netconfNetconfServerSession, - NetconfTerminationReason netconfTerminationReason) { - logger.debug("Session {} terminated, reason: {}", netconfNetconfServerSession, + public void onSessionTerminated(final NetconfServerSession netconfNetconfServerSession, + final NetconfTerminationReason netconfTerminationReason) { + LOG.debug("Session {} terminated, reason: {}", netconfNetconfServerSession, netconfTerminationReason.getErrorMessage()); onDown(netconfNetconfServerSession); } @Override - public void onMessage(NetconfServerSession session, NetconfMessage netconfMessage) { + public void onMessage(final NetconfServerSession session, final NetconfMessage netconfMessage) { try { Preconditions.checkState(operationRouter != null, "Cannot handle message, session up was not yet received"); @@ -86,7 +85,7 @@ public class NetconfServerSessionListener implements NetconfSessionListener