public void start() throws Exception {
    	// create the watcher for future configuration updatess
        pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() {
            public void childEvent(CuratorFramework aClient, PathChildrenCacheEvent event)
                    throws Exception {
                Type eventType = event.getType();
                ChildData data = event.getData();
                
                String path = null; 
                if (data != null) {
                    path = data.getPath();
                    
                    // scrub configRootPath out of the key name
                    String key = removeRootPath(path);

                    byte[] value = data.getData();
                    String stringValue = new String(value, charset);

                    logger.debug("received update to pathName [{}], eventType [{}]", path, eventType);
                    logger.debug("key [{}], and value [{}]", key, stringValue);

                    // fire event to all listeners
                    Map<String, Object> added = null;
                    Map<String, Object> changed = null;
                    Map<String, Object> deleted = null;
                    if (eventType == Type.CHILD_ADDED) {
                        added = new HashMap<String, Object>(1);
                        added.put(key, stringValue);
                    } else if (eventType == Type.CHILD_UPDATED) {
                        changed = new HashMap<String, Object>(1);
                        changed.put(key, stringValue);
                    } else if (eventType == Type.CHILD_REMOVED) {
                        deleted = new HashMap<String, Object>(1);
                        deleted.put(key, stringValue);
                    }

                    WatchedUpdateResult result = WatchedUpdateResult.createIncremental(added,
                        changed, deleted);                        

                    fireEvent(result);
                }
            }
        });

        // passing true to trigger an initial rebuild upon starting.  (blocking call)
        pathChildrenCache.start(true);
    }
public void start() throws Exception {
    	
        pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() {
            public void childEvent(CuratorFramework aClient, PathChildrenCacheEvent event)
                    throws Exception {
                Type eventType = event.getType();
                ChildData data = event.getData();
                
                String path = null; 
                if (data != null) {
                    path = data.getPath();
                    
                    
                    String key = removeRootPath(path);

                    byte[] value = data.getData();
                    String stringValue = new String(value, charset);

                    logger.debug("received update to pathName [{}], eventType [{}]", path, eventType);
                    logger.debug("key [{}], and value [{}]", key, stringValue);

                    
                    Map<String, Object> added = null;
                    Map<String, Object> changed = null;
                    Map<String, Object> deleted = null;
                    if (eventType == Type.CHILD_ADDED) {
                        added = new HashMap<String, Object>(1);
                        added.put(key, stringValue);
                    } else if (eventType == Type.CHILD_UPDATED) {
                        changed = new HashMap<String, Object>(1);
                        changed.put(key, stringValue);
                    } else if (eventType == Type.CHILD_REMOVED) {
                        deleted = new HashMap<String, Object>(1);
                        deleted.put(key, stringValue);
                    }

                    WatchedUpdateResult result = WatchedUpdateResult.createIncremental(added,
                        changed, deleted);                        

                    fireEvent(result);
                }
            }
        });

        
        pathChildrenCache.start(true);
    }
public void start ( ) throws Exception { // create the watcher for future configuration updatess pathChildrenCache . getListenable ( ) . addListener ( new PathChildrenCacheListener ( ) { public void childEvent ( CuratorFramework aClient , PathChildrenCacheEvent event ) throws Exception { Type eventType = event . getType ( ) ; ChildData data = event . getData ( ) ; String path = null ; if ( data != null ) { path = data . getPath ( ) ; // scrub configRootPath out of the key name String key = removeRootPath ( path ) ; byte [ ] value = data . getData ( ) ; String stringValue = new String ( value , charset ) ; logger . debug ( "received update to pathName [{}], eventType [{}]" , path , eventType ) ; logger . debug ( "key [{}], and value [{}]" , key , stringValue ) ; // fire event to all listeners Map < String , Object > added = null ; Map < String , Object > changed = null ; Map < String , Object > deleted = null ; if ( eventType == Type . CHILD_ADDED ) { added = new HashMap < String , Object > ( 1 ) ; added . put ( key , stringValue ) ; } else if ( eventType == Type . CHILD_UPDATED ) { changed = new HashMap < String , Object > ( 1 ) ; changed . put ( key , stringValue ) ; } else if ( eventType == Type . CHILD_REMOVED ) { deleted = new HashMap < String , Object > ( 1 ) ; deleted . put ( key , stringValue ) ; } WatchedUpdateResult result = WatchedUpdateResult . createIncremental ( added , changed , deleted ) ; fireEvent ( result ) ; } } } ) ; // passing true to trigger an initial rebuild upon starting.  (blocking call) pathChildrenCache . start ( true ) ; }
Adds a listener to the pathChildrenCache, initializes the cache, then starts the cache-management background thread

@throws Exception
Adds a listener to the pathChildrenCache initializes the cache then starts the cache - management background thread