diff --git a/core/src/main/java/hudson/model/queue/Latch.java b/core/src/main/java/hudson/model/queue/Latch.java index 6cc29bacb8..431dc1c191 100644 --- a/core/src/main/java/hudson/model/queue/Latch.java +++ b/core/src/main/java/hudson/model/queue/Latch.java @@ -23,6 +23,8 @@ */ package hudson.model.queue; +import hudson.AbortException; + /** * A concurrency primitive that waits for N number of threads to synchronize. * If any of the threads are interrupted while waiting for the completion of the condition, @@ -33,14 +35,19 @@ package hudson.model.queue; class Latch { private final int n; private int i=0; - private boolean interrupted; + /** + * If the synchronization on the latch is aborted/interrupted, + * point to the stack trace where that happened. If null, + * no interruption happened. + */ + private Exception interrupted; public Latch(int n) { this.n = n; } public synchronized void abort() { - interrupted = true; + interrupted = new AbortException(); notifyAll(); } @@ -65,11 +72,11 @@ class Latch { if (i==threshold) { notifyAll(); } else { - while (i