Merge "Bug 1029: Remove dead code: samples/clustersession"
[controller.git] / opendaylight / adsal / clustering / services_implementation / src / main / java / org / opendaylight / controller / clustering / services_implementation / internal / ClusterGlobalManager.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.clustering.services_implementation.internal;
11
12 import java.util.Map;
13
14 import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
15 import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
16 import org.slf4j.Logger;
17 import org.slf4j.LoggerFactory;
18
19 public class ClusterGlobalManager
20     extends ClusterManagerCommon
21     implements IClusterGlobalServices {
22     protected static final Logger logger = LoggerFactory.getLogger(ClusterGlobalManager.class);
23
24     @Override
25     void setCacheUpdateAware(Map props, ICacheUpdateAware s) {
26         logger.trace("setCacheUpdateAware: {}",s);
27         if (props.get("containerName") != null) {
28             // If we got a reference with the containerName property
29             // that is not what we are looking for, so filter it out.
30             return;
31         }
32         super.setCacheUpdateAware(props, s);
33     }
34
35     @Override
36     void unsetCacheUpdateAware(Map props, ICacheUpdateAware s) {
37         logger.trace("unsetCacheUpdateAware: {}",s);
38         if (props.get("containerName") != null) {
39             // If we got a reference with the containerName property
40             // that is not what we are looking for, so filter it out.
41             return;
42         }
43         super.unsetCacheUpdateAware(props, s);
44     }
45
46     @Override
47     public void removeContainerCaches(String containerName) {
48         logger.debug("Removing caches for container {}", containerName);
49         for (String cacheName : clusterService.getCacheList(containerName)) {
50             clusterService.destroyCache(containerName, cacheName);
51         }
52     }
53
54 }