Source:
void doStart(boolean restart) { assert holdsLock(lock); stopRequested = false; final List<String> command = new ArrayList<String>(this.command); if(restart) { command.add(CommandLineConstants.PROCESS_RESTARTED); } log.startingProcess(processName); log.debugf("Process name='%s' command='%s' workingDirectory='%s'", processName, command, workingDirectory); final ProcessBuilder builder = new ProcessBuilder(command.stream().map(c -> c.trim()).collect(Collectors.toList())); builder.environment().putAll(env); builder.directory(new File(workingDirectory)); final Process process; try { process = builder.start(); } catch (IOException e) { processController.operationFailed(processName, ProcessMessageHandler.OperationType.START); log.failedToStartProcess(processName); return; } final long startTime = System.currentTimeMillis(); final OutputStream stdin = process.getOutputStream(); final InputStream stderr = process.getErrorStream(); final InputStream stdout = process.getInputStream(); final Thread stderrThread = new Thread(new ReadTask(stderr, processController.getStderr())); stderrThread.setName(String.format("stderr for %s", processName)); stderrThread.start(); final Thread stdoutThread = new Thread(new ReadTask(stdout, processController.getStdout())); stdoutThread.setName(String.format("stdout for %s", processName)); stdoutThread.start(); joinThread = new Thread(new JoinTask(startTime)); joinThread.setName(String.format("reaper for %s", processName)); joinThread.start(); boolean ok = false; try { OutputStream base64 = getBase64OutputStream(stdin); base64.write(authKey.getBytes(Charset.forName("US-ASCII"))); base64.close(); ok = true; } catch (Exception e) { log.failedToSendAuthKey(processName, e); } this.process = process; this.stdin = stdin; if(ok) { state = State.STARTED; processController.processStarted(processName); } else { processController.operationFailed(processName, ProcessMessageHandler.OperationType.START); } return; }

Target:
void doStart(boolean restart) { assert holdsLock(lock); stopRequested = false; final List<String> command = new ArrayList<String>(this.command); if(restart) { command.add(CommandLineConstants.PROCESS_RESTARTED); } log.startingProcess(processName); log.debugf("Process name='%s' command='%s' workingDirectory='%s'", processName, command, workingDirectory); final ProcessBuilder builder = new ProcessBuilder(command.stream().map(c -> c.trim()).collect(Collectors.toList())); builder.environment().putAll(env); builder.directory(new File(workingDirectory)); final Process process; try { process = builder.start(); } catch (IOException e) { processController.operationFailed(processName, ProcessMessageHandler.OperationType.START); log.failedToStartProcess(e,processName); return; } final long startTime = System.currentTimeMillis(); final OutputStream stdin = process.getOutputStream(); final InputStream stderr = process.getErrorStream(); final InputStream stdout = process.getInputStream(); final Thread stderrThread = new Thread(new ReadTask(stderr, processController.getStderr())); stderrThread.setName(String.format("stderr for %s", processName)); stderrThread.start(); final Thread stdoutThread = new Thread(new ReadTask(stdout, processController.getStdout())); stdoutThread.setName(String.format("stdout for %s", processName)); stdoutThread.start(); joinThread = new Thread(new JoinTask(startTime)); joinThread.setName(String.format("reaper for %s", processName)); joinThread.start(); boolean ok = false; try { OutputStream base64 = getBase64OutputStream(stdin); base64.write(authKey.getBytes(Charset.forName("US-ASCII"))); base64.close(); ok = true; } catch (Exception e) { log.failedToSendAuthKey(processName, e); } this.process = process; this.stdin = stdin; if(ok) { state = State.STARTED; processController.processStarted(processName); } else { processController.operationFailed(processName, ProcessMessageHandler.OperationType.START); } return; }