public void activateNode(NodeId nodeId, Resource resource) { try { writeLock.lock(); String hostName = nodeId.getHost(); Host host = nodeCollections.get(hostName); if (host == null) { host = new Host(hostName); nodeCollections.put(hostName, host); } host.activateNode(resource); for (NodeAttribute attribute : host.getAttributes().keySet()) { clusterAttributes.get(attribute.getAttributeKey()).removeNode(resource); } } finally { writeLock.unlock(); } }
public void deactivateNode(NodeId nodeId) { try { writeLock.lock(); Host host = nodeCollections.get(nodeId.getHost()); for (NodeAttribute attribute : host.getAttributes().keySet()) { clusterAttributes.get(attribute.getAttributeKey()) .removeNode(host.getResource()); } host.deactivateNode(); } finally { writeLock.unlock(); } }
node = new Host(nodeHost); nodeCollections.put(nodeHost, node); case REMOVE: removeNodeFromAttributes(nodeHost, attributes.keySet()); node.removeAttributes(attributes); break; case ADD: clusterAttributes.putAll(newAttributesToBeAdded); addNodeToAttribute(nodeHost, attributes); node.addAttributes(attributes); break; case REPLACE: replaceNodeToAttribute(nodeHost, attributePrefix, node.getAttributes(), attributes); node.replaceAttributes(attributes, attributePrefix); break; default: