提交 7baa9c11 编写于 作者: K kohsuke

if the connection is terminated, abort the pending executing calls.

The primary motivation of this is to cancel the CLI task execution when the connection is severed (for example by Ctrl+C on the CLI JVM.)

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@18941 71c3de6d-444a-0410-be80-ed276b4c234a
上级 45b30a3d
......@@ -37,9 +37,7 @@ import java.util.Collections;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
......@@ -556,6 +554,13 @@ public class Channel implements VirtualChannel, IChannel {
req.abort(e);
pendingCalls.clear();
}
synchronized (executingCalls) {
for (Request<?, ?> r : executingCalls.values()) {
java.util.concurrent.Future<?> f = r.future;
if(f!=null) f.cancel(true);
}
executingCalls.clear();
}
} finally {
notifyAll();
......
......@@ -69,7 +69,7 @@ abstract class Request<RSP extends Serializable,EXC extends Throwable> extends C
/**
* While executing the call this is set to the handle of the execution.
*/
private volatile transient Future<?> future;
protected volatile transient Future<?> future;
protected Request() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册