@Override protected void subTearDown1() throws Exception { if (this.process != null) { this.process.destroy(); this.process = null; } if (this.processOutReader != null && this.processOutReader.isRunning()) { this.processOutReader.stop(); } if (this.processErrReader != null && this.processErrReader.isRunning()) { this.processErrReader.stop(); } if (this.workingDirectory != null) { try { //delete(this.workingDirectory); } finally { this.workingDirectory = null; } } subTearDown2(); }
ProcessStreamReader processOutReader = new ProcessStreamReader(forkedProcess.getInputStream()).start(); ProcessStreamReader processErrReader = new ProcessStreamReader(forkedProcess.getErrorStream()).start();
public ProcessStreamReader start() { synchronized (this) { if (this.thread == null) { this.thread = new Thread(this, createThreadName()); this.thread.start(); } else if (this.thread.isAlive()){ throw new IllegalStateException(this + " has already started"); } else { throw new IllegalStateException(this + " was stopped and cannot be restarted"); } } return this; }
final ProcessStreamReader stderrReader = new ProcessStreamReader(serverProcess.getErrorStream(), new InputListener() { @Override message.append(line).append(StringUtils.LINE_SEPARATOR); }).start(); final int exitValue = serverProcess.exitValue(); stderrReader.join(Long.MAX_VALUE); stderrReader.stop(); serverProcess.getErrorStream().close(); getGfsh().getSignalHandler().unregisterListener(serverSignalListener);
.continueReadingMillis(2*1000) .build() .start(); final int exitValue = locatorProcess.exitValue(); stderrReader.join(PROCESS_STREAM_READER_JOIN_TIMEOUT_MILLIS); // was Long.MAX_VALUE stderrReader.stopAsync(PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS); // stop will close ErrorStream getGfsh().getSignalHandler().unregisterListener(locatorSignalListener);
@Override public String toString() { final StringBuilder sb = new StringBuilder(getClass().getSimpleName()); sb.append(" Thread").append(" #").append(System.identityHashCode(this)); sb.append(" alive=").append(isRunning()); //this.thread == null ? false : this.thread.isAlive()); sb.append(" listener=").append(this.inputListener); return sb.toString(); }
@Override public void run() { try { Thread.sleep(delayMillis); } catch (InterruptedException e) { } finally { stop(); } } };
final ProcessStreamReader stderrReader = new ProcessStreamReader(locatorProcess.getErrorStream(), new InputListener() { @Override message.append(line).append(StringUtils.LINE_SEPARATOR); }).start(); final int exitValue = locatorProcess.exitValue(); stderrReader.join(Long.MAX_VALUE); stderrReader.stop(); locatorProcess.getErrorStream().close(); getGfsh().getSignalHandler().unregisterListener(locatorSignalListener);
@Override public String toString() { final StringBuilder sb = new StringBuilder(getClass().getSimpleName()); sb.append(" Thread").append(" #").append(System.identityHashCode(this)); sb.append(" alive=").append(isRunning()); //this.thread == null ? false : this.thread.isAlive()); sb.append(" listener=").append(this.listener); return sb.toString(); }
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
@Override protected final void subTearDown1() throws Exception { if (this.process != null) { this.process.destroy(); this.process = null; } if (this.processOutReader != null && this.processOutReader.isRunning()) { this.processOutReader.stop(); } if (this.processErrReader != null && this.processErrReader.isRunning()) { this.processErrReader.stop(); } if (this.workingDirectory != null) { try { //delete(this.workingDirectory); keep it around to help debug failures } finally { this.workingDirectory = null; } } subTearDown2(); }
public ProcessStreamReader start() { synchronized (this) { if (this.thread == null) { this.thread = new Thread(this, createThreadName()); this.thread.setDaemon(true); this.thread.start(); } else if (this.thread.isAlive()){ throw new IllegalStateException(this + " has already started"); } else { throw new IllegalStateException(this + " was stopped and cannot be restarted"); } } return this; }
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();
this.processOutReader = new ProcessStreamReader(this.process.getInputStream()).start(); this.processErrReader = new ProcessStreamReader(this.process.getErrorStream()).start();