+
+ @Override
+ public void containerCreate(String containerName) {
+ // Nothing to do
+ }
+
+ @Override
+ public void containerDestroy(String containerName) {
+ Set<NodeConnector> removeNodeConnectorSet = new HashSet<NodeConnector>();
+ Set<Node> removeNodeSet = new HashSet<Node>();
+ for (Map.Entry<NodeConnector, Set<String>> entry : nodeConnectorContainerMap.entrySet()) {
+ Set<String> ncContainers = entry.getValue();
+ if (ncContainers.contains(containerName)) {
+ NodeConnector nodeConnector = entry.getKey();
+ removeNodeConnectorSet.add(nodeConnector);
+ }
+ }
+ for (Map.Entry<Node, Set<String>> entry : nodeContainerMap.entrySet()) {
+ Set<String> nodeContainers = entry.getValue();
+ if (nodeContainers.contains(containerName)) {
+ Node node = entry.getKey();
+ removeNodeSet.add(node);
+ }
+ }
+ for (NodeConnector nodeConnector : removeNodeConnectorSet) {
+ Set<String> ncContainers = nodeConnectorContainerMap.get(nodeConnector);
+ ncContainers.remove(containerName);
+ if (ncContainers.isEmpty()) {
+ nodeConnectorContainerMap.remove(nodeConnector);
+ }
+ }
+ for (Node node : removeNodeSet) {
+ Set<String> nodeContainers = nodeContainerMap.get(node);
+ nodeContainers.remove(containerName);
+ if (nodeContainers.isEmpty()) {
+ nodeContainerMap.remove(node);
+ }
+ }
+ }