private void monitorProcess() {
		taskExecutor.execute(new Runnable() {

			@Override
			public void run() {
				Process process = ShellCommandProcessor.this.process;
				if (process == null) {
					if (log.isDebugEnabled()) {
						log.debug("Process destroyed before starting process monitor");
					}
					return;
				}

				int result;
				try {
					if (log.isDebugEnabled()) {
						log.debug("Monitoring process '" + command + "'");
					}
					result = process.waitFor();
					if (log.isInfoEnabled()) {
						log.info("Process '" + command + "' terminated with value " + result);
					}
				}
				catch (InterruptedException e) {
					Thread.currentThread().interrupt();
					log.error("Interrupted - stopping adapter", e);
					stop();
				}
				finally {
					process.destroy();
				}
			}
		});
	}
Runs a thread that waits for the Process result.
extensions/spring-xd-extension-process/src/main/java/org/springframework/xd/extension/process/ShellCommandProcessor.java