private void writeDeployment(ModuleDescriptor moduleDescriptor,
			RuntimeModuleDeploymentProperties runtimeProperties,
			Container container, ResultCollector collector)
			throws InterruptedException, NoContainerException {
		int moduleSequence = runtimeProperties.getSequence();
		String containerName = container.getName();
		String deploymentPath = new ModuleDeploymentsPath()
				.setContainer(containerName)
				.setDeploymentUnitName(moduleDescriptor.getGroup())
				.setModuleType(moduleDescriptor.getType().toString())
				.setModuleLabel(moduleDescriptor.getModuleLabel())
				.setModuleSequence(String.valueOf(moduleSequence)).build();
		String statusPath = Paths.build(deploymentPath, Paths.STATUS);
		collector.addPending(containerName, moduleSequence, moduleDescriptor.createKey());
		try {
			ensureModuleDeploymentPath(deploymentPath, statusPath, moduleDescriptor,
					runtimeProperties, container);

			// set the collector as a watch; it is possible that
			// a. that the container has already updated this node (unlikely)
			// b. the deployment was previously written; in this case read
			//    the status written by the container
			byte[] data = zkConnection.getClient().getData().usingWatcher(collector).forPath(statusPath);
			if (data != null && data.length > 0) {
				collector.addResult(createResult(deploymentPath, data));
			}
		}
		catch (InterruptedException e) {
			throw e;
		}
		catch (Exception e) {
			collector.addResult(createResult(deploymentPath, e));
		}
	}
Writes the module deployment to the container.

@param moduleDescriptor			descriptor for module to deploy
@param runtimeProperties			runtime deployment properties provider for the module
@param container					the container to deploy
@param collector					the result collector
@throws InterruptedException 	if the executing thread is interrupted
@throws NoContainerException 	if there are no containers that match the criteria
                             	for module deployment
spring-xd-dirt/src/main/java/org/springframework/xd/dirt/server/admin/deployment/zk/ModuleDeploymentWriter.java