Source:
private void deployUnallocatedStreamModules(CuratorFramework client, Container container) throws Exception { List<ModuleDeploymentRequestsPath> requestedModulesPaths = getAllModuleDeploymentRequests(); for (ChildData data : streamDeployments.getCurrentData()) { String streamName = ZooKeeperUtils.deploymentNameConverter.convert(data); final Stream stream = ZooKeeperUtils.loadStream(client, streamName, streamFactory); if (stream != null) { List<ModuleDeploymentRequestsPath> requestedModules = ModuleDeploymentRequestsPath.getModulesForDeploymentUnit( requestedModulesPaths, streamName); Set<String> deployedModules = new HashSet<String>(); for (String deployedModule : client.getChildren().forPath(Paths.build(data.getPath(), Paths.MODULES))) { deployedModules.add(Paths.stripPath(new StreamDeploymentsPath(Paths.build(data.getPath(), Paths.MODULES, deployedModule)).getModule())); } Collection<ModuleDescriptor> deployedDescriptors = new ArrayList<ModuleDescriptor>(); for (ModuleDeploymentRequestsPath path : requestedModules) { ModuleDescriptor moduleDescriptor = stream.getModuleDescriptor(path.getModuleLabel()); if ((path.getModuleSequence().equals("0") || !deployedModules.contains(path.getModule())) && !deployedDescriptors.contains(moduleDescriptor)) { deployedDescriptors.add(moduleDescriptor); RuntimeModuleDeploymentProperties moduleDeploymentProperties = new RuntimeModuleDeploymentProperties(); moduleDeploymentProperties.putAll(ZooKeeperUtils.bytesToMap(moduleDeploymentRequests.getCurrentData( path.build()).getData())); deployModule(container, new ModuleDeployment(stream, moduleDescriptor, moduleDeploymentProperties)); } } } } }

Target:
private void deployUnallocatedStreamModules(CuratorFramework client, Container container) throws Exception { List<ModuleDeploymentRequestsPath> requestedModulesPaths = getAllModuleDeploymentRequests(); for (ChildData data : streamDeployments.getCurrentData()) { String streamName = ZooKeeperUtils.stripPathConverter.convert(data); final Stream stream = DeploymentLoader.loadStream(client, streamName, streamFactory); if (stream != null) { List<ModuleDeploymentRequestsPath> requestedModules = ModuleDeploymentRequestsPath.getModulesForDeploymentUnit( requestedModulesPaths, streamName); Set<String> deployedModules = new HashSet<String>(); for (String deployedModule : client.getChildren().forPath(Paths.build(data.getPath(), Paths.MODULES))) { deployedModules.add(Paths.stripPath(new StreamDeploymentsPath(Paths.build(data.getPath(), Paths.MODULES, deployedModule)).getModuleInstanceAsString())); } Set<ModuleDescriptor> deployedDescriptors = new HashSet<ModuleDescriptor>(); for (ModuleDeploymentRequestsPath path : requestedModules) { ModuleDescriptor moduleDescriptor = stream.getModuleDescriptor(path.getModuleLabel()); if ((path.getModuleSequence().equals("0") || !deployedModules.contains(path.getModuleInstanceAsString())) && !deployedDescriptors.contains(moduleDescriptor)) { deployedDescriptors.add(moduleDescriptor); RuntimeModuleDeploymentProperties moduleDeploymentProperties = new RuntimeModuleDeploymentProperties(); moduleDeploymentProperties.putAll(ZooKeeperUtils.bytesToMap(moduleDeploymentRequests.getCurrentData( path.build()).getData())); deployModule(container, new ModuleDeployment(stream, moduleDescriptor, moduleDeploymentProperties)); } } } } }