apiCache.getListenable().addListener(new PathChildrenCacheListener() {
@Override
public void childEvent(CuratorFramework curatorFramework, PathChildrenCacheEvent event) throws Exception {
try {
LOG.debug("event: " + event);
ChildData childData = event.getData();
if (childData != null) {
PathChildrenCacheEvent.Type eventType = event.getType();
byte[] data = childData.getData();
LOG.info("Got childEvent " + eventType + " " + childData);
if (isValidData(data)) {
loadData(curatorFramework, eventType, data);
} else {
// do we have any children?
String path1 = childData.getPath();
List<String> names = curatorFramework.getChildren().forPath(path1);
for (String name : names) {
String fullPath = path1 + "/" + name;
data = curatorFramework.getData().forPath(fullPath);
if (isValidData(data)) {