org.apache.curator.framework.recipes.cache.TreeCacheEvent Java Examples

The following examples show how to use org.apache.curator.framework.recipes.cache.TreeCacheEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccumuloGraph.java    From vertexium with Apache License 2.0 6 votes vote down vote up
private void invalidatePropertyDefinitions(TreeCacheEvent event) {
    if (event == null || event.getData() == null) {
        return;
    }

    String path = event.getData().getPath();
    byte[] bytes = event.getData().getData();
    if (path == null || bytes == null) {
        return;
    }

    if (!path.startsWith(zkPath + "/" + ZK_DEFINE_PROPERTY)) {
        return;
    }

    String key = new String(bytes, StandardCharsets.UTF_8);
    if (key == null) {
        return;
    }

    String propertyName = key.substring(METADATA_DEFINE_PROPERTY_PREFIX.length());
    LOGGER.debug("invalidating property definition: %s", propertyName);
    invalidatePropertyDefinition(propertyName);
}
 
Example #2
Source File: LogSearchConfigZKHelper.java    From ambari-logsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Create listener for znode of log level filters - can be used for Log Feeder as it can be useful if it's monitoring the log level changes
 * @param clusterName name of the cluster
 * @param gson object to be used for json serialization
 * @param logLevelFilterMonitor log level filter monitor object that can be used to do something during znode chagne
 * @return listener response
 */
public static TreeCacheListener createTreeCacheListener(String clusterName, Gson gson, LogLevelFilterMonitor logLevelFilterMonitor) {
  return new TreeCacheListener() {
    private final Set<TreeCacheEvent.Type> nodeEvents = ImmutableSet.of(TreeCacheEvent.Type.NODE_ADDED, TreeCacheEvent.Type.NODE_UPDATED, TreeCacheEvent.Type.NODE_REMOVED);
    public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
      if (!nodeEvents.contains(event.getType())) {
        return;
      }
      String nodeName = ZKPaths.getNodeFromPath(event.getData().getPath());
      String nodeData = new String(event.getData().getData());
      TreeCacheEvent.Type eventType = event.getType();

      String configPathStab = String.format("/%s/", clusterName);

      if (event.getData().getPath().startsWith(configPathStab + "loglevelfilter/")) {
        handleLogLevelFilterChange(eventType, nodeName, nodeData, gson, logLevelFilterMonitor);
      }
    }
  };
}
 
Example #3
Source File: LogSearchConfigZKHelper.java    From ambari-logsearch with Apache License 2.0 6 votes vote down vote up
/**
 * Call log level filter monitor interface to handle node related operations (on update/remove)
 * @param eventType zookeeper event type (add/update/remove)
 * @param nodeName name of the znode
 * @param nodeData znode data
 * @param gson object that can serialize inputs
 * @param logLevelFilterMonitor monitor object that can pass business logic that should happen during znode events
 */
static void handleLogLevelFilterChange(final TreeCacheEvent.Type eventType, final String nodeName, final String nodeData,
                                              final Gson gson, final LogLevelFilterMonitor logLevelFilterMonitor) {
  switch (eventType) {
    case NODE_ADDED:
    case NODE_UPDATED:
      logger.info("Node added/updated under loglevelfilter ZK node: " + nodeName);
      LogLevelFilter logLevelFilter = gson.fromJson(nodeData, LogLevelFilter.class);
      logLevelFilterMonitor.setLogLevelFilter(nodeName, logLevelFilter);
      break;
    case NODE_REMOVED:
      logger.info("Node removed loglevelfilter input ZK node: " + nodeName);
      logLevelFilterMonitor.removeLogLevelFilter(nodeName);
      break;
    default:
      break;
  }
}
 
Example #4
Source File: DubboServiceDiscoveryAutoConfiguration.java    From spring-cloud-alibaba with Apache License 2.0 6 votes vote down vote up
/**
 * Resolve the name of service.
 * @param event {@link TreeCacheEvent}
 * @return If the Zookeeper's {@link ChildData#getPath() node path} that was
 * notified comes from {@link ServiceInstance the service instance}, return it's
 * parent path as the service name, or return <code>null</code>
 */
private String resolveServiceName(TreeCacheEvent event) {
	ChildData childData = event.getData();
	String path = childData.getPath();
	if (logger.isDebugEnabled()) {
		logger.debug("ZK node[path : {}] event type : {}", path, event.getType());
	}

	String serviceName = null;

	if (pathMatcher.match(serviceInstancePathPattern, path)) {
		Map<String, String> variables = pathMatcher
				.extractUriTemplateVariables(serviceInstancePathPattern, path);
		serviceName = variables.get(SERVICE_NAME_PATH_VARIABLE_NAME);
	}

	return serviceName;
}
 
Example #5
Source File: ZookeeperMasterMonitor.java    From titus-control-plane with Apache License 2.0 6 votes vote down vote up
private void retrieveAllMasters(CuratorFramework curator, TreeCacheEvent cacheEvent) {
    logger.debug("Received TreeCacheEvent: {}", cacheEvent);

    Map<String, ChildData> currentChildren = Evaluators.getOrDefault(
            masterMonitor.getCurrentChildren(allMastersPath), Collections.emptyMap()
    );

    List<MasterInstance> updatedMasterList = new ArrayList<>();
    for (Map.Entry<String, ChildData> entry : currentChildren.entrySet()) {
        parseMasterInstanceData(entry.getValue()).ifPresent(updatedMasterList::add);
    }

    if (!knownMasterInstances.equals(updatedMasterList)) {
        logger.info("Detected change in TitusMaster state and/or topology: {}", updatedMasterList);
        knownMasterInstances = updatedMasterList;
        masterUpdates.onNext(Collections.unmodifiableList(updatedMasterList));
    }
}
 
Example #6
Source File: SimpleEventListener.java    From metron with Apache License 2.0 6 votes vote down vote up
@Override
public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
  String path = null;
  byte[] data = null;
  if(event != null && event.getData() != null) {
    path = event.getData().getPath();
    data = event.getData().getData();
  }
  LOG.debug("Type: {}, Path: {}, Data: {}", event.getType(), (path == null?"":path) , (data == null?"":new String(data,
      StandardCharsets.UTF_8)));
  List<Callback> callback = callbacks.get(event.getType());
  if(callback != null) {
    for(Callback cb : callback) {
      cb.apply(client, path, data);
    }
  }
}
 
Example #7
Source File: ZKCacheListener.java    From mpush with Apache License 2.0 6 votes vote down vote up
@Override
public void childEvent(CuratorFramework curator, TreeCacheEvent event) throws Exception {
    ChildData data = event.getData();
    if (data == null) return;
    String dataPath = data.getPath();
    if (Strings.isNullOrEmpty(dataPath)) return;
    if (dataPath.startsWith(watchPath)) {
        switch (event.getType()) {
            case NODE_ADDED:
                listener.onServiceAdded(dataPath, Jsons.fromJson(data.getData(), CommonServiceNode.class));
                break;
            case NODE_REMOVED:
                listener.onServiceRemoved(dataPath, Jsons.fromJson(data.getData(), CommonServiceNode.class));
                break;
            case NODE_UPDATED:
                listener.onServiceUpdated(dataPath, Jsons.fromJson(data.getData(), CommonServiceNode.class));
                break;
        }
        Logs.RSD.info("ZK node data change={}, nodePath={}, watchPath={}, ns={}");
    }
}
 
Example #8
Source File: CloudJobConfigurationListenerTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
@Test
public void assertChildEventWhenStateIsUpdateAndIsConfigPathAndDaemonJob() throws Exception {
    cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, 
            new ChildData("/config/job/test_job", null, CloudJsonConstants.getJobJson(CloudJobExecutionType.DAEMON).getBytes())));
    verify(readyService).remove(Collections.singletonList("test_job"));
    verify(producerManager).reschedule(ArgumentMatchers.<String>any());
}
 
Example #9
Source File: TenantDebugger.java    From vespa with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
    switch (event.getType()) {
        case NODE_ADDED:
        case NODE_REMOVED:
        case NODE_UPDATED:
            log.log(Level.INFO, event.toString());
            break;
    }
}
 
Example #10
Source File: CuratorZookeeperCenterRepository.java    From shardingsphere with Apache License 2.0 5 votes vote down vote up
private DataChangedEvent.ChangedType getChangedType(final TreeCacheEvent event) {
    switch (event.getType()) {
        case NODE_ADDED:
            return DataChangedEvent.ChangedType.ADDED;
        case NODE_UPDATED:
            return DataChangedEvent.ChangedType.UPDATED;
        case NODE_REMOVED:
            return DataChangedEvent.ChangedType.DELETED;
        default:
            return DataChangedEvent.ChangedType.IGNORED;
    }
}
 
Example #11
Source File: ZookeeperServiceImporter.java    From vertx-service-discovery with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework curatorFramework,
                       TreeCacheEvent treeCacheEvent) throws Exception {
  if (started) {
    compute(null);
  }
}
 
Example #12
Source File: ZkClientConfigHandler.java    From seldon-server with Apache License 2.0 5 votes vote down vote up
private void afterCacheBuilt() throws Exception {
    // first get the clients
    Collection<ChildData> clientChildrenData = handler.getImmediateChildren("/" + CLIENT_LIST_LOCATION);
    logger.info("Found " +clientChildrenData.size() + " clients on start up.");
    for(ChildData clientChildData : clientChildrenData) {
        childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, clientChildData));
        // then the children of clients
        Collection<ChildData> furtherChildren = handler.getChildren(clientChildData.getPath());
        logger.info("Found " +furtherChildren.size() + " children for client "+ retrieveClientName(clientChildData.getPath())+" on startup");
        for (ChildData child : furtherChildren){
            childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, child));
        }
    }

}
 
Example #13
Source File: TopicListener.java    From kafka-monitor with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework curator, TreeCacheEvent event) throws Exception {
    ChildData data = event.getData();
    if (data != null) {
        if (event.getType() == NODE_ADDED) {

        }
        String path = data.getPath();
        //判断是否为topics节点
        if (path.contains(String.format("%s/",ZkUtils.BrokerTopicsPath())) && (!path.contains("partitions"))) {
            Topic topic = JSONObject.parseObject(data.getData(), Topic.class);
            String name = path.substring(path.lastIndexOf("/") + 1, path.length());
            topic.setName(name);

            int[] tPartiyions = topic.getPartitions().keySet().stream().mapToInt((t) -> Integer.valueOf(t)).sorted().toArray();
            for (Object key : tPartiyions
                    ) {
                String partitionPath = String.format("%s/partitions/%s/state", path, key);
                String state = new String(curator.getData().forPath(partitionPath));
                Partition partition = JSONObject.parseObject(state, Partition.class);
                JSONArray replicas = topic.getPartitions().getJSONArray(String.valueOf(key));
                int[] replicasArray = new int[replicas.size()];
                for (int i = 0; i <
                        replicas.size(); i++) {
                    replicasArray[i] = replicas.getInteger(i);
                }
                partition.setReplicasArray(replicasArray);

                topic.getPartitionMap().put((Integer) key, partition);
            }
            topicList.add(topic);
        }
    }
}
 
Example #14
Source File: CloudJobConfigurationListenerTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
@Test
public void assertChildEventWhenIsNotConfigPath() throws Exception {
    cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_UPDATED, new ChildData("/other/test_job", null, "".getBytes())));
    verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
    verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
    verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
}
 
Example #15
Source File: CloudJobConfigurationListenerTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
@Test
public void assertChildEventWhenIsRootConfigPath() throws Exception {
    cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_REMOVED, new ChildData("/config/job", null, "".getBytes())));
    verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
    verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
    verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
}
 
Example #16
Source File: CloudJobConfigurationListener.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
private CloudJobConfiguration getJobConfig(final TreeCacheEvent event) {
    try {
        return CloudJobConfigurationGsonFactory.fromJson(new String(event.getData().getData()));
        // CHECKSTYLE:OFF
    } catch (final Exception ex) {
        log.warn("Wrong Cloud Job Configuration with:", ex.getMessage());
        // CHECKSTYLE:ON
        return null;
    }
}
 
Example #17
Source File: CloudJobConfigurationListenerTest.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 5 votes vote down vote up
@Test
public void assertChildEventWhenDataIsNull() throws Exception {
    cloudJobConfigurationListener.childEvent(null, new TreeCacheEvent(TreeCacheEvent.Type.NODE_ADDED, null));
    verify(producerManager, times(0)).schedule(ArgumentMatchers.<CloudJobConfiguration>any());
    verify(producerManager, times(0)).reschedule(ArgumentMatchers.<String>any());
    verify(producerManager, times(0)).unschedule(ArgumentMatchers.<String>any());
}
 
Example #18
Source File: AbstractJobListener.java    From shardingsphere-elasticjob-lite with Apache License 2.0 5 votes vote down vote up
@Override
public final void childEvent(final CuratorFramework client, final TreeCacheEvent event) {
    ChildData childData = event.getData();
    if (null == childData) {
        return;
    }
    String path = childData.getPath();
    if (path.isEmpty()) {
        return;
    }
    dataChanged(path, event.getType(), null == childData.getData() ? "" : new String(childData.getData(), Charsets.UTF_8));
}
 
Example #19
Source File: ZookeeperAppSubscriber.java    From sofa-dashboard-client with Apache License 2.0 5 votes vote down vote up
/**
 * Remove cached application instance according to zookeeper node event.
 *
 * @param event zookeeper node changed event
 */
private void doRemoveApplications(TreeCacheEvent event) {
    ChildData chileData = event.getData();
    if (chileData == null) {
        return; // Maybe null if session is timeout
    }

    Application app = ZookeeperRegistryUtils.parseSessionNode(chileData.getPath());
    if (app != null) {
        applications.computeIfPresent(app.getAppName(), (key, value) -> {
            value.remove(app); // Always remove whatever if it's exists
            return value;
        });
    }
}
 
Example #20
Source File: ZookeeperUserWatcher.java    From Thunder with Apache License 2.0 5 votes vote down vote up
@Override
public void nodeUpdated(TreeCacheEvent event) throws Exception {
    UserEntity userEntity = invoker.getObject(path, UserEntity.class);

    LOG.info("Watched - user [{}] is changed", userEntity.getName());

    callback.onUserChanged(userEntity);
}
 
Example #21
Source File: ZookeeperTreeCacheListener.java    From Thunder with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
    TreeCacheEvent.Type type = event.getType();
    switch (type) {
        case INITIALIZED:
            initialized(event);
            break;
        case NODE_ADDED:
            nodeAdded(event);
            break;
        case NODE_UPDATED:
            nodeUpdated(event);
            break;
        case NODE_REMOVED:
            nodeRemoved(event);
            break;
        case CONNECTION_SUSPENDED:
            connectionSuspended(event);
            break;
        case CONNECTION_RECONNECTED:
            connectionReconnected(event);
            break;
        case CONNECTION_LOST:
            connectionLost(event);
            break;
    }
}
 
Example #22
Source File: ZKConfigurationsCache.java    From metron with Apache License 2.0 5 votes vote down vote up
private void initializeCache(CuratorFramework client) {
  Lock writeLock = lock.writeLock();
  try {
    writeLock.lock();
    SimpleEventListener listener = new SimpleEventListener.Builder()
            .with(Iterables.transform(updaters, u -> u::update)
                    , TreeCacheEvent.Type.NODE_ADDED
                    , TreeCacheEvent.Type.NODE_UPDATED
            )
            .with(Iterables.transform(updaters, u -> u::delete)
                    , TreeCacheEvent.Type.NODE_REMOVED
            )
            .build();
    cache = new ZKCache.Builder()
            .withClient(client)
            .withListener(listener)
            .withRoot(Constants.ZOOKEEPER_TOPOLOGY_ROOT)
            .build();

    for (ConfigurationsUpdater<? extends Configurations> updater : updaters) {
      updater.forceUpdate(client);
    }
    cache.start();
  } catch (Exception e) {
    LOG.error("Unable to initialize zookeeper cache: " + e.getMessage(), e);
    throw new IllegalStateException("Unable to initialize zookeeper cache: " + e.getMessage(), e);
  }
  finally {
    writeLock.unlock();
  }
}
 
Example #23
Source File: ConfiguredBolt.java    From metron with Apache License 2.0 5 votes vote down vote up
/**
 * Prepares the cache that will be used during Metron's interaction with ZooKeeper.
 */
protected void prepCache() {
  try {
    if (client == null) {
      RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
      client = CuratorFrameworkFactory.newClient(zookeeperUrl, retryPolicy);
    }
    client.start();

    //this is temporary to ensure that any validation passes.
    //The individual bolt will reinitialize stellar to dynamically pull from
    //zookeeper.
    ConfigurationsUtils.setupStellarStatically(client);
    if (cache == null) {
      ConfigurationsUpdater<CONFIG_T> updater = createUpdater();
      SimpleEventListener listener = new SimpleEventListener.Builder()
                                                            .with( updater::update
                                                                 , TreeCacheEvent.Type.NODE_ADDED
                                                                 , TreeCacheEvent.Type.NODE_UPDATED
                                                                 )
                                                            .with( updater::delete
                                                                 , TreeCacheEvent.Type.NODE_REMOVED
                                                                 )
                                                            .build();
      cache = new ZKCache.Builder()
                         .withClient(client)
                         .withListener(listener)
                         .withRoot(Constants.ZOOKEEPER_TOPOLOGY_ROOT)
                         .build();
      updater.forceUpdate(client);
      cache.start();
    }
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
    throw new RuntimeException(e);
  }
}
 
Example #24
Source File: SimpleEventListener.java    From metron with Apache License 2.0 5 votes vote down vote up
/**
 * Add a callback bound to one or more TreeCacheEvent.Type.
 * @param callback The iterable of callbacks to be called when an event of each of types happens
 * @param types The zookeeper event types to bind to
 * @return The Builder
 */
public Builder with(Iterable<? extends Callback> callback, TreeCacheEvent.Type... types) {
  for(TreeCacheEvent.Type t : types) {
    List<Callback> cbs = callbacks.get(t);
    if(cbs == null) {
      cbs = new ArrayList<>();
    }
    Iterables.addAll(cbs, callback);
    callbacks.put(t, cbs);
  }
  return this;
}
 
Example #25
Source File: ProfileBuilderBolt.java    From metron with Apache License 2.0 5 votes vote down vote up
/**
 * Setup connectivity to Zookeeper which provides the necessary configuration for the bolt.
 */
private void setupZookeeper() {
  try {
    if (zookeeperClient == null) {
      RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
      zookeeperClient = CuratorFrameworkFactory.newClient(zookeeperUrl, retryPolicy);
    }
    zookeeperClient.start();

    // this is temporary to ensure that any validation passes. the individual bolt
    // will reinitialize stellar to dynamically pull from zookeeper.
    ConfigurationsUtils.setupStellarStatically(zookeeperClient);
    if (zookeeperCache == null) {
      ConfigurationsUpdater<ProfilerConfigurations> updater = createUpdater();
      SimpleEventListener listener = new SimpleEventListener.Builder()
              .with( updater::update, TreeCacheEvent.Type.NODE_ADDED, TreeCacheEvent.Type.NODE_UPDATED)
              .with( updater::delete, TreeCacheEvent.Type.NODE_REMOVED)
              .build();
      zookeeperCache = new ZKCache.Builder()
              .withClient(zookeeperClient)
              .withListener(listener)
              .withRoot(Constants.ZOOKEEPER_TOPOLOGY_ROOT)
              .build();
      updater.forceUpdate(zookeeperClient);
      zookeeperCache.start();
    }
  } catch (Exception e) {
    LOG.error(e.getMessage(), e);
    throw new RuntimeException(e);
  }
}
 
Example #26
Source File: ZookeeperServiceWatch.java    From spring-cloud-zookeeper with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework client, TreeCacheEvent event)
		throws Exception {
	if (event.getType().equals(TreeCacheEvent.Type.NODE_ADDED)
			|| event.getType().equals(TreeCacheEvent.Type.NODE_REMOVED)
			|| event.getType().equals(TreeCacheEvent.Type.NODE_UPDATED)) {
		long newCacheChange = this.cacheChange.incrementAndGet();
		this.publisher.publishEvent(new HeartbeatEvent(this, newCacheChange));
	}
}
 
Example #27
Source File: ConfigWatcher.java    From spring-cloud-zookeeper with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework client, TreeCacheEvent event)
		throws Exception {
	TreeCacheEvent.Type eventType = event.getType();
	if (eventType == NODE_ADDED || eventType == NODE_REMOVED
			|| eventType == NODE_UPDATED) {
		this.publisher
				.publishEvent(new RefreshEvent(this, event, getEventDesc(event)));
	}
}
 
Example #28
Source File: ConfigWatcher.java    From spring-cloud-zookeeper with Apache License 2.0 5 votes vote down vote up
public String getEventDesc(TreeCacheEvent event) {
	StringBuilder out = new StringBuilder();
	out.append("type=").append(event.getType());
	out.append(", path=").append(event.getData().getPath());
	byte[] data = event.getData().getData();
	if (data != null && data.length > 0) {
		out.append(", data=").append(new String(data, Charset.forName("UTF-8")));
	}
	return out.toString();
}
 
Example #29
Source File: ModeledCacheImpl.java    From curator with Apache License 2.0 5 votes vote down vote up
@Override
public void childEvent(CuratorFramework client, TreeCacheEvent event)
{
    try
    {
        internalChildEvent(event);
    }
    catch ( Exception e )
    {
        ThreadUtils.checkInterrupted(e);

        listenerContainer.forEach(l -> l.handleException(e));
    }
}
 
Example #30
Source File: TreeCacheExample.java    From ZKRecipesByExample with Apache License 2.0 5 votes vote down vote up
private static void addListener(final TreeCache cache) {
	TreeCacheListener listener = new TreeCacheListener() {

		@Override
		public void childEvent(CuratorFramework client, TreeCacheEvent event) throws Exception {
			switch (event.getType()) {
			case NODE_ADDED: {
				System.out.println("TreeNode added: " + ZKPaths.getNodeFromPath(event.getData().getPath()) + ", value: "
						+ new String(event.getData().getData()));
				break;
			}
			case NODE_UPDATED: {
				System.out.println("TreeNode changed: " + ZKPaths.getNodeFromPath(event.getData().getPath()) + ", value: "
						+ new String(event.getData().getData()));
				break;
			}
			case NODE_REMOVED: {
				System.out.println("TreeNode removed: " + ZKPaths.getNodeFromPath(event.getData().getPath()));
				break;
			}
			default:
				System.out.println("Other event: " + event.getType().name());
			}
		}

	};

	cache.getListenable().addListener(listener);
}