Bug-4757:Li: TransactionManager does not get closed and future connections are rejected. 84/31184/1
authorKamal Rameshan <kramesha@cisco.com>
Fri, 11 Dec 2015 01:51:40 +0000 (17:51 -0800)
committerKamal Rameshan <kramesha@cisco.com>
Fri, 11 Dec 2015 01:51:40 +0000 (17:51 -0800)
Signed-off-by: Kamal Rameshan <kramesha@cisco.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceTransactionChainManagerProvider.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java

index 8c1f7c18f39e658ab09d677922444b64c55ce263..8690e6403c3ea310c55417c1edcce2c0331b6839 100644 (file)
@@ -43,6 +43,7 @@ public class DeviceTransactionChainManagerProvider {
                 Registration registration = new Registration() {
                     @Override
                     public void close() throws Exception {
+                        LOG.trace("TransactionChainManagerRegistration Close called for {}", nodeId);
                         txChManagers.remove(nodeId);
                     }
                 };
index 06228701495bec0be2cbedd9934f90ac2ae76226..ce1f0368ce8203f02f62cd2b7e58695d3a801dd1 100644 (file)
@@ -62,7 +62,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
     private TransactionChainManagerStatus transactionChainManagerStatus;
     private ReadyForNewTransactionChainHandler readyForNewTransactionChainHandler;
     private final KeyedInstanceIdentifier<Node, NodeKey> nodeII;
-    private Registration managerRegistration;
+    private volatile Registration managerRegistration;
 
     TransactionChainManager(@Nonnull final DataBroker dataBroker,
                             @Nonnull final KeyedInstanceIdentifier<Node, NodeKey> nodeII,
@@ -240,8 +240,10 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
         }
         synchronized (this) {
             try {
-                LOG.debug("Closing registration in manager.");
-                managerRegistration.close();
+                if (managerRegistration != null) {
+                    LOG.debug("Closing registration in manager.");
+                    managerRegistration.close();
+                }
             } catch (Exception e) {
                 LOG.warn("Failed to close transaction chain manager's registration.", e);
             }