if (item.task instanceof PlaceholderTask && ((PlaceholderTask) item.task).context.equals(getContext())) {
Queue.getInstance().cancel(item);
break;
}
}
Jenkins j = Jenkins.getInstance();
if (j != null) {
// if we are already running, kill the ongoing activities, which releases PlaceholderExecutable from its sleep loop
// Similar to Run.getExecutor (and proposed Executables.getExecutor), but distinct since we do not have the Executable yet:
COMPUTERS: for (Computer c : j.getComputers()) {
for (Executor e : c.getExecutors()) {
Queue.Executable exec = e.getCurrentExecutable();
if (exec instanceof PlaceholderTask.PlaceholderExecutable && ((PlaceholderTask.PlaceholderExecutable) exec).getParent().context.equals(getContext())) {
PlaceholderTask.finish(((PlaceholderTask.PlaceholderExecutable) exec).getParent().cookie);
break COMPUTERS;