Improve netconf negotiator messages 24/5124/6
authorRobert Varga <rovarga@cisco.com>
Wed, 5 Feb 2014 07:36:23 +0000 (08:36 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 7 Feb 2014 01:45:04 +0000 (01:45 +0000)
Change-Id: I8b36f2fa6173055e5fc34783873a55cdf240589d
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractNetconfSessionNegotiator.java

index 8cfd177fceff03dad3cd1609d11152f30e55811a..a485a4ea9436391d7433e91370f37481734d4e7b 100644 (file)
@@ -119,7 +119,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
             public void run(final Timeout timeout) throws Exception {
                 synchronized (this) {
                     if (state != State.ESTABLISHED) {
-                        logger.debug("Connection timeout after {}", timeout);
+                        logger.debug("Connection timeout after {}, session is in state {}", timeout, state);
                         final IllegalStateException cause = new IllegalStateException(
                                 "Session was not established after " + timeout);
                         negotiationFailed(cause);
@@ -181,7 +181,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
         return true;
     }
 
-    private void changeState(final State newState) {
+    private synchronized void changeState(final State newState) {
         logger.debug("Changing state from : {} to : {}", state, newState);
         Preconditions.checkState(isStateChangePermitted(state, newState), "Cannot change state from %s to %s", state,
                 newState);
@@ -206,6 +206,7 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
         if (state == State.OPEN_WAIT && newState == State.FAILED)
             return true;
 
+        logger.debug("Transition from {} to {} is not allowed", state, newState);
         return false;
     }
 }