fixed #614 and #292. When the executor thread is interrupted, it is handled as an abort, not as a failure.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3499 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-06-22 01:14:05 +00:00
1 parent c99e53c534
commit a5ac77ebb6
7 files changed
+27 -17

No files matched your search

+8 -8
View File
@@ -32,7 +32,7 @@ public abstract class Proc {
* if there's an error killing a process
* and a stack trace could help the trouble-shooting.
*/
public abstract void kill() throws IOException;
public abstract void kill() throws IOException, InterruptedException;
/**
* Waits for the completion of the process.
@@ -46,7 +46,7 @@ public abstract class Proc {
* if there's an error launching/joining a process
* and a stack trace could help the trouble-shooting.
*/
public abstract int join() throws IOException;
public abstract int join() throws IOException, InterruptedException;
/**
* Locally launched process.
@@ -96,7 +96,7 @@ public abstract class Proc {
* Waits for the completion of the process.
*/
@Override
public int join() {
public int join() throws InterruptedException {
try {
t1.join();
t2.join();
@@ -104,12 +104,12 @@ public abstract class Proc {
} catch (InterruptedException e) {
// aborting. kill the process
proc.destroy();
return -1;
throw e;
}
}
@Override
public void kill() {
public void kill() throws InterruptedException {
proc.destroy();
join();
}
@@ -160,19 +160,19 @@ public abstract class Proc {
}
@Override
public void kill() throws IOException {
public void kill() throws IOException, InterruptedException {
process.cancel(true);
join();
}
@Override
public int join() throws IOException {
public int join() throws IOException, InterruptedException {
try {
return process.get();
} catch (InterruptedException e) {
// aborting. kill the process
process.cancel(true);
return -1;
throw e;
} catch (ExecutionException e) {
if(e.getCause() instanceof IOException)
throw (IOException)e.getCause();