Skip to content
This repository has been archived by the owner on Mar 19, 2018. It is now read-only.

Commit

Permalink
Merge pull request #6 from njam/issue-6
Browse files Browse the repository at this point in the history
Some video streams not removed from status properly
  • Loading branch information
njam committed Jun 9, 2014
2 parents e1a820d + 1a0f19a commit 456c2cf
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ch/cargomedia/wms/process/InterruptibleProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public class InterruptibleProcess extends Thread {

private String[] _command;
private Process _process = null;
private BufferedReader _processReader = null;
private Boolean _interrupted = false;

Expand All @@ -25,7 +26,7 @@ public void run() {
try {
ProcessBuilder builder = new ProcessBuilder(_command);
builder.redirectErrorStream(true);
Process _process = builder.start();
_process = builder.start();

_processReader = new BufferedReader(new InputStreamReader(_process.getInputStream()));
String line;
Expand All @@ -51,7 +52,7 @@ public void run() {
@Override
public void interrupt() {
_interrupted = true;
this._closeProcessReader();
this._interruptProcess();
super.interrupt();
}

Expand All @@ -73,7 +74,10 @@ public void throwExceptionIfAny() throws Exception {
}
}

private void _closeProcessReader() {
private void _interruptProcess() {
if (null != _process) {
_process.destroy();
}
if (null != _processReader) {
try {
_processReader.close();
Expand Down

0 comments on commit 456c2cf

Please sign in to comment.