Source:
<code>private void onChildAdded(CuratorFramework client, ChildData data) throws Exception { String path = data.getPath(); ModuleDeploymentsPath moduleDeploymentsPath = new ModuleDeploymentsPath(path); String unitName = moduleDeploymentsPath.getDeploymentUnitName(); String moduleType = moduleDeploymentsPath.getModuleType(); String moduleLabel = moduleDeploymentsPath.getModuleLabel(); int moduleSequence = moduleDeploymentsPath.getModuleSequence(); ModuleDescriptor.Key key = new ModuleDescriptor.Key(unitName, ModuleType.valueOf(moduleType), moduleLabel); String container = moduleDeploymentsPath.getContainer(); Module module = null; ModuleDeploymentStatus status; RuntimeModuleDeploymentProperties properties = new RuntimeModuleDeploymentProperties(); properties.putAll(ZooKeeperUtils.bytesToMap(data.getData())); try { module = (ModuleType.job.toString().equals(moduleType)) ? deployJobModule(client, unitName, moduleLabel, properties) : deployStreamModule(client, unitName, moduleType, moduleLabel, properties); if (module == null) { status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.failed, "Module deployment returned null"); } else { status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.deployed, null); } } catch (Exception e) { status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.failed, e.toString()); logger.error("Exception deploying module", e); } try { writeModuleMetadata(module, path, client); client.setData().forPath(status.buildPath(), ZooKeeperUtils.mapToBytes(status.toMap())); } <START> catch (KeeperException.NodeExistsException ne) { <END> logger.info("The module metadata path for the module of type for already exists.", moduleLabel, moduleType, unitName); } catch (KeeperException.NoNodeException e) { logger.warn("During deployment of module of type for {}, an undeployment request " + "was detected; this module will be undeployed.", moduleLabel, moduleType, unitName); if (logger.isTraceEnabled()) { logger.trace("Path " + path + " was removed", e); } } }</code><technical_language>question is - assume metadata is same? force update of metadata if exists</technical_language>

Target:
private void onChildAdded(CuratorFramework client, ChildData data) throws Exception { String path = data.getPath(); ModuleDeploymentsPath moduleDeploymentsPath = new ModuleDeploymentsPath(path); String unitName = moduleDeploymentsPath.getDeploymentUnitName(); String moduleType = moduleDeploymentsPath.getModuleType(); String moduleLabel = moduleDeploymentsPath.getModuleLabel(); int moduleSequence = moduleDeploymentsPath.getModuleSequence(); ModuleDescriptor.Key key = new ModuleDescriptor.Key(unitName, ModuleType.valueOf(moduleType), moduleLabel); String container = moduleDeploymentsPath.getContainer(); Module module = null; ModuleDeploymentStatus status; RuntimeModuleDeploymentProperties properties = new RuntimeModuleDeploymentProperties(); properties.putAll(ZooKeeperUtils.bytesToMap(data.getData())); try { module = (ModuleType.job.toString().equals(moduleType)) ? deployJobModule(client, unitName, moduleLabel, properties) : deployStreamModule(client, unitName, moduleType, moduleLabel, properties); if (module == null) { status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.failed, "Module deployment returned null"); } else { status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.deployed, null); } } catch (Exception e) { status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.failed, e.toString()); logger.error("Exception deploying module", e); } try { writeModuleMetadata(module, path, client, moduleSequence); client.setData().forPath(status.buildPath(), ZooKeeperUtils.mapToBytes(status.toMap())); } catch (KeeperException.NoNodeException e) { logger.warn("During deployment of module of type for with sequence number {}," + "an undeployment request was detected; this module will be undeployed.", moduleLabel, moduleType, unitName, moduleSequence); if (logger.isTraceEnabled()) { logger.trace("Path " + path + " was removed", e); } } }