BUG-2739 Fix concurrent metadata cleanup for netconf-connector
[controller.git] / opendaylight / md-sal / sal-netconf-connector / src / main / java / org / opendaylight / controller / sal / connect / netconf / listener / NetconfDeviceCommunicator.java
index ce5aa79af0f85c44dc0beaa68650597f4974213a..4f2f6ab38ea204a45b02473b55130900d9c627c3 100644 (file)
@@ -110,7 +110,7 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
 
             @Override
             public void operationComplete(Future<Object> future) throws Exception {
-                if (!future.isSuccess()) {
+                if (!future.isSuccess() && !future.isCancelled()) {
                     logger.debug("{}: Connection failed", id, future.cause());
                     NetconfDeviceCommunicator.this.remoteDevice.onRemoteSessionFailed(future.cause());
                 }
@@ -197,9 +197,8 @@ public class NetconfDeviceCommunicator implements NetconfClientSessionListener,
         // Disconnect from device
         if(session != null) {
             session.close();
+            // tear down not necessary, called indirectly by above close
         }
-
-        tearDown(id + ": Netconf session closed");
     }
 
     @Override