question: public void addServices ( List < ServiceDefinition > services ) throws Exception { ensurePathExists ( ) ; Set < String > remainingDescriptors = new HashSet < > ( dataManager . getChildren ( ZK_SERVICE_DEFINITION_PATH ) ) ; for ( ServiceDefinition service : services ) { LOG . debug ( String . format ( "Adding Service %s into ZK" , service . serviceId ) ) ; String path = getServiceDefinitionPath ( service . serviceId ) ; try { Stat before = dataManager . checkExists ( path ) ; dataManager . putData ( path , service ) ; Stat after = dataManager . checkExists ( path ) ; nodeUpdated ( path , before , after ) ; remainingDescriptors . remove ( service . serviceId ) ; } catch ( Exception e ) { LOG . error ( String . format ( "Failed to add Service %s into ZK, path: %s" , service . serviceId , path ) , e ) ; throw e ; } } for ( String descriptorName : remainingDescriptors ) { LOG . info ( String . format ( "Removing old Service %s from ZK" , descriptorName ) ) ; dataManager . removeNode ( ZK_SERVICE_DEFINITION_PATH + "/" + descriptorName ) ; } }
target:  Adds all the given service definitions to the Zookeeper tree