提交 fe0aa498 编写于 作者: K kohsuke

if a subtask is aborted, all the executors should be aborted.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34628 71c3de6d-444a-0410-be80-ed276b4c234a
上级 3bf7e661
......@@ -149,6 +149,8 @@ public class Executor extends Thread implements ModelObject {
} catch (InterruptedException e) {
workUnit.context.abort(e);
continue;
} finally {
workUnit.setExecutor(null);
}
}
}
......
......@@ -58,6 +58,11 @@ public final class WorkUnitContext {
private List<WorkUnit> workUnits = new ArrayList<WorkUnit>();
/**
* If the execution is aborted, set to non-null that indicates where it was aborted.
*/
private volatile Throwable aborted;
public WorkUnitContext(BuildableItem item) {
this.item = item;
this.task = item.task;
......@@ -134,7 +139,10 @@ public final class WorkUnitContext {
/**
* When one of the work unit is aborted, call this method to abort all the other work units.
*/
public void abort(Throwable cause) {
public synchronized void abort(Throwable cause) {
if (cause==null) throw new IllegalArgumentException();
if (aborted!=null) return; // already aborted
aborted = cause;
startLatch.abort(cause);
endLatch.abort(cause);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册