Merge "Move init and destroy empty impl from Activator classes. Have only one empty...
authorGiovanni Meo <gmeo@cisco.com>
Mon, 23 Sep 2013 13:10:49 +0000 (13:10 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 23 Sep 2013 13:10:49 +0000 (13:10 +0000)
opendaylight/clustering/services/src/main/java/org/opendaylight/controller/clustering/services/IClusterGlobalServices.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/Activator.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterGlobalManager.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManager.java
opendaylight/clustering/services_implementation/src/main/java/org/opendaylight/controller/clustering/services_implementation/internal/ClusterManagerCommon.java
opendaylight/clustering/stub/src/main/java/org/opendaylight/controller/clustering/stub/internal/ClusterGlobalManager.java
opendaylight/containermanager/implementation/src/main/java/org/opendaylight/controller/containermanager/internal/ContainerManager.java
opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java

index 58d8c0051b45e2efba4fd9fc587f0a28bc49a1be..e25a9537c0a07c7e0525e59f2bb951a922377355 100644 (file)
@@ -26,4 +26,5 @@ package org.opendaylight.controller.clustering.services;
  *
  */
 public interface IClusterGlobalServices extends IClusterServicesCommon {
+    public void removeContainerCaches(String containerName);
 }
index 35b51466795c060c0dfc0112ea8826917edda2ce..1c6a5db6d5e0530de4ddae9c0d0b6c7892af2506 100644 (file)
@@ -10,7 +10,6 @@
 package org.opendaylight.controller.clustering.services_implementation.internal;
 
 import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.controller.sal.core.IContainerAware;
 
 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
 import org.opendaylight.controller.clustering.services.IClusterContainerServices;
@@ -111,7 +110,7 @@ public class Activator extends ComponentActivatorAbstractBase {
     public void configureGlobalInstance(Component c, Object imp) {
         if (imp.equals(ClusterManager.class)) {
             // export the service for Apps and Plugins
-            c.setInterface(new String[] { IClusterServices.class.getName(), IContainerAware.class.getName() }, null);
+            c.setInterface(new String[] { IClusterServices.class.getName() }, null);
         }
 
         if (imp.equals(ClusterGlobalManager.class)) {
index ce33ac8639cf89977c1c1f7f79d19e15a2da3dae..34ddb7a207edcd5b262f2de09366fbc11c3dde62 100644 (file)
@@ -41,4 +41,13 @@ public class ClusterGlobalManager
         }
         super.unsetCacheUpdateAware(props, s);
     }
+
+    @Override
+    public void removeContainerCaches(String containerName) {
+        logger.debug("Removing caches for container {}", containerName);
+        for (String cacheName : clusterService.getCacheList(containerName)) {
+            clusterService.destroyCache(containerName, cacheName);
+        }
+    }
+
 }
index ca13fbc2d23df7cb94d295401e48c30ec78bb9aa..4a67e76ab25b5e92e63e7433cd9efdea5934a7af 100644 (file)
@@ -55,11 +55,10 @@ import org.opendaylight.controller.clustering.services.IClusterServices;
 import org.opendaylight.controller.clustering.services.IGetUpdates;
 import org.opendaylight.controller.clustering.services.IListenRoleChange;
 import org.opendaylight.controller.clustering.services.ListenRoleChangeAddException;
-import org.opendaylight.controller.sal.core.IContainerAware;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ClusterManager implements IClusterServices, IContainerAware {
+public class ClusterManager implements IClusterServices {
     protected static final Logger logger = LoggerFactory
             .getLogger(ClusterManager.class);
     private DefaultCacheManager cm;
@@ -371,6 +370,7 @@ public class ClusterManager implements IClusterServices, IContainerAware {
             return null;
         }
         for (String cacheName : manager.getCacheNames()) {
+            if (!manager.isRunning(cacheName)) continue;
             if (cacheName.startsWith("{" + containerName + "}_")) {
                 String[] res = cacheName.split("[{}]");
                 if (res.length >= 4 && res[1].equals(containerName)
@@ -676,21 +676,4 @@ public class ClusterManager implements IClusterServices, IContainerAware {
             }
         }
     }
-
-    private void removeContainerCaches(String containerName) {
-        logger.info("Destroying caches for container {}", containerName);
-        for (String cacheName : this.getCacheList(containerName)) {
-            this.destroyCache(containerName, cacheName);
-        }
-    }
-
-    @Override
-    public void containerCreate(String arg0) {
-        // no op
-    }
-
-    @Override
-    public void containerDestroy(String container) {
-        removeContainerCaches(container);
-    }
 }
index 90299e5ac960dcbd34c63df4cd8418c5b57ddf5f..61681bc90add8d596a69658720cd170a65c9cd32 100644 (file)
@@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
 
 public abstract class ClusterManagerCommon implements IClusterServicesCommon {
     protected String containerName = null;
-    private IClusterServices clusterService = null;
+    protected IClusterServices clusterService = null;
     protected static final Logger logger = LoggerFactory
             .getLogger(ClusterManagerCommon.class);
     private ConcurrentMap<String, GetUpdatesContainer> cacheUpdateAware =
index f9f9be8db2878f5e64dc9319518ba7d33f57a6e5..6dcc0a10a3526b8a4ac2793e6084f4fc044c945c 100644 (file)
@@ -18,4 +18,6 @@ public class ClusterGlobalManager extends ClusterManagerCommon implements
     public ClusterGlobalManager() throws UnknownHostException {
         super();
     }
+    public void removeContainerCaches(String containerName) {
+    }
 }
index d67ee94b62e88fc3cf1157f878a373352651ff7a..c9190af03a587a76cd581591c59a33cc7036baee 100644 (file)
@@ -1182,6 +1182,7 @@ public class ContainerManager extends Authorization<String> implements IContaine
             }
         }
 
+        if (delete) clusterServices.removeContainerCaches(containerName);
         return status;
     }
 
index 004d1b98db3eff61292937888a6fa34b1f9a4ee6..8f905a999a02f3b2c5f3d12395bc0d1a97ac5cc1 100644 (file)
@@ -918,10 +918,10 @@ public class TopologyManagerImpl implements
                     // Lets sleep for sometime to allow aggregation of event
                     Thread.sleep(100);
                 } catch (InterruptedException e1) {
-                    log.warn("TopologyNotify interrupted {}", e1.getMessage());
                     if (shuttingDown) {
                         return;
                     }
+                    log.warn("TopologyNotify interrupted {}", e1.getMessage());
                 } catch (Exception e2) {
                     log.error("", e2);
                 }