@Override public boolean cancel(boolean mayInterruptIfRunning) { Queue q = Hudson.getInstance().getQueue(); synchronized (q) { if (executor != null) { if (mayInterruptIfRunning) executor.interrupt(); return mayInterruptIfRunning; } return q.cancel(task); } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { Queue q = Jenkins.getInstance().getQueue(); synchronized (q) { synchronized (this) { if (!executors.isEmpty()) { if (mayInterruptIfRunning) for (Executor e : executors) e.interrupt(); return mayInterruptIfRunning; } return q.cancel(task); } } }