@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); } } }
private void cancel(Queue.Item item, Queue queue, String branch) { try { LOGGER.log(Level.INFO, "Cancelling job {0} for branch {1}", LoggerUtil.toArray(item.task.getName(), branch)); queue.cancel(item); } catch (Exception e) { LOGGER.log(Level.SEVERE, "Error cancelling queued build", e); } }
/** * Called from {@code queue.jelly} and {@code entries.jelly}. */ @RequirePOST public HttpResponse doCancelItem(@QueryParameter long id) throws IOException, ServletException { Item item = getItem(id); if (item != null) { if(item.hasCancelPermission()){ cancel(item); } } // else too late, ignore (JENKINS-14813) return HttpResponses.forwardToPreviousPage(); }
/** @deprecated Use {@link #doCancelItem} instead. */ @Deprecated @RequirePOST public HttpResponse doCancelQueue() throws IOException, ServletException { if(hasCancelPermission()){ Jenkins.getInstance().getQueue().cancel(this); } return HttpResponses.forwardToPreviousPage(); }
/** * Standard implementation of {@link ParameterizedJob#doCancelQueue}. */ @RequirePOST public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { asJob().checkPermission(Item.CANCEL); Jenkins.getInstance().getQueue().cancel(asJob()); rsp.forwardToPreviousPage(req); }
/** * Marks the build as disabled. * The method will ignore the disable command if {@link #supportsMakeDisabled()} * returns false. The enable command will be executed in any case. * @param b true - disable, false - enable */ default void makeDisabled(boolean b) throws IOException { if (isDisabled() == b) { return; // noop } if (b && !supportsMakeDisabled()) { return; // do nothing if the disabling is unsupported } setDisabled(b); if (b) { Jenkins.getInstance().getQueue().cancel(this); } save(); ItemListener.fireOnUpdated(this); }
/** * Called from {@code queue.jelly} and {@code entries.jelly}. */ @RequirePOST public HttpResponse doCancelItem(@QueryParameter long id) throws IOException, ServletException { Item item = getItem(id); if (item != null) { cancel(item); } // else too late, ignore (JENKINS-14813) return HttpResponses.forwardToPreviousPage(); }
/** * Called from queue.jelly. */ public HttpResponse doCancelQueue() throws IOException, ServletException { Hudson.getInstance().getQueue().cancel(this); return HttpResponses.forwardToPreviousPage(); }
/** * Marks the build as disabled. */ public void makeDisabled(boolean b) throws IOException { if(disabled==b) return; // noop this.disabled = b; if(b) Hudson.getInstance().getQueue().cancel(this); save(); }
/** * Marks the build as disabled. */ public void makeDisabled(boolean b) throws IOException { if(disabled==b) return; // noop this.disabled = b; if(b) Hudson.getInstance().getQueue().cancel(this); save(); }
private void cancelPreviousJobsInQueueThatMatch(@Nonnull BitbucketCause bitbucketCause) { logger.fine("Looking for queued jobs that match PR ID: " + bitbucketCause.getPullRequestId()); Queue queue = getInstance().getQueue(); for (Queue.Item item : queue.getItems()) { if (hasCauseFromTheSamePullRequest(item.getCauses(), bitbucketCause)) { logger.fine("Canceling item in queue: " + item); queue.cancel(item); } } }
/** * Called from queue.jelly. */ public HttpResponse doCancelQueue() throws IOException, ServletException { Hudson.getInstance().getQueue().cancel(this); return HttpResponses.forwardToPreviousPage(); }
/** @deprecated Use {@link #doCancelItem} instead. */ @Deprecated @RequirePOST public HttpResponse doCancelQueue() throws IOException, ServletException { Jenkins.getInstance().getQueue().cancel(this); return HttpResponses.forwardToPreviousPage(); }
/** * Called from queue.jelly. */ public HttpResponse doCancelQueue() throws IOException, ServletException { Hudson.getInstance().getQueue().cancel(this); return HttpResponses.forwardToPreviousPage(); }
/** * Called from queue.jelly. */ public HttpResponse doCancelQueue() throws IOException, ServletException { Hudson.getInstance().getQueue().cancel(this); return HttpResponses.forwardToPreviousPage(); }
/** * Cancels a scheduled build. */ public void doCancelQueue(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { checkPermission(BUILD); Hudson.getInstance().getQueue().cancel(this); rsp.forwardToPreviousPage(req); }
/** * Cancels a scheduled build. */ public void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(BUILD); Hudson.getInstance().getQueue().cancel(this); rsp.forwardToPreviousPage(req); }
/** * Cancels a scheduled build. */ public void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { checkPermission(BUILD); Hudson.getInstance().getQueue().cancel(this); rsp.forwardToPreviousPage(req); }
/** * Standard implementation of {@link ParameterizedJob#doCancelQueue}. */ @RequirePOST public final void doCancelQueue( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { asJob().checkPermission(Item.CANCEL); Jenkins.getInstance().getQueue().cancel(asJob()); rsp.forwardToPreviousPage(req); }