Example #1
0
 @Override
 protected void performDelete() throws IOException, InterruptedException {
   // if a build is in progress. Cancel it.
   RunT lb = getLastBuild();
   if (lb != null) {
     Executor e = lb.getExecutor();
     if (e != null) {
       e.interrupt();
       // should we block until the build is cancelled?
     }
   }
   super.performDelete();
 }
Example #2
0
    /**
     * Deletes this item.
     *
     * <p>
     * Any exception indicates the deletion has failed, but {@link AbortException} would prevent the caller
     * from showing the stack trace. This
     */
    public synchronized void delete() throws IOException, InterruptedException {
        checkPermission(DELETE);
        performDelete();

        // defer the notification to avoid the lock ordering problem. See JENKINS-19446.
        MasterComputer.threadPoolForRemoting.submit(new java.util.concurrent.Callable<Void>() {
            @Override
            public Void call() throws Exception {
                invokeOnDeleted();
                Jenkins.getInstance().rebuildDependencyGraphAsync();
                return null;
            }

            /**
             * A pointless function to work around what appears to be a HotSpot problem. See JENKINS-5756 and bug 6933067
             * on BugParade for more details.
             */
            private void invokeOnDeleted() throws IOException {
                getParent().onDeleted(AbstractItem.this);
            }
        });
    }