/** Process the {@link WatchedEvent} for a node which represents an {@link AuthenticationKey} */ void processChildNode(WatchedEvent event) throws KeeperException, InterruptedException { final String path = event.getPath(); switch (event.getType()) { case NodeDeleted: // Key expired if (null == path) { log.error("Got null path for NodeDeleted event"); return; } // Pull off the base ZK path and the '/' separator String childName = path.substring(baseNode.length() + 1); secretManager.removeKey(Integer.parseInt(childName)); break; case None: // Not connected, don't care. We'll update when we're reconnected break; case NodeCreated: // New key created if (null == path) { log.error("Got null path for NodeCreated event"); return; } // Get the data and reset the watcher AuthenticationKey key = deserializeKey(zk.getData(path, this, null)); log.debug("Adding AuthenticationKey with keyId {}", key.getKeyId()); secretManager.addKey(key); break; case NodeDataChanged: // Key changed, could happen on restart after not running Accumulo. if (null == path) { log.error("Got null path for NodeDataChanged event"); return; } // Get the data and reset the watcher AuthenticationKey newKey = deserializeKey(zk.getData(path, this, null)); // Will overwrite the old key if one exists secretManager.addKey(newKey); break; case NodeChildrenChanged: // no children for the children.. log.warn("Unexpected NodeChildrenChanged event for authentication key node {}", path); break; default: log.warn("Unsupported event type: {}", event.getType()); break; } }