hudson.model.Executor.interrupt()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中hudson.model.Executor.interrupt()方法的一些代码示例,展示了Executor.interrupt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.interrupt()方法的具体详情如下:
包路径:hudson.model.Executor
类名称:Executor
方法名:interrupt

Executor.interrupt介绍

[英]Interrupt the execution, but instead of marking the build as aborted, mark it as specified result.
[中]中断执行,但不要将生成标记为中止,而是将其标记为指定结果。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * Interrupt the execution. Mark the cause and the status accordingly.
 */
public void interrupt(Result result, CauseOfInterruption... causes) {
  interrupt(result, false, causes);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Interrupt the execution,
 * but instead of marking the build as aborted, mark it as specified result.
 *
 * @since 1.417
 */
public void interrupt(Result result) {
  interrupt(result, false);
}

代码示例来源:origin: jenkinsci/jenkins

void interruptForShutdown() {
  interrupt(Result.ABORTED, true);
}
/**

代码示例来源:origin: jenkinsci/jenkins

@Override
  public void run() {
    for( Executor e : executors )
      if(e.isIdle())
        e.interrupt();
  }
});

代码示例来源:origin: jenkinsci/jenkins

interrupt(Result.ABORTED);

代码示例来源:origin: jenkinsci/jenkins

private void interrupt(Result result, boolean forShutdown) {
  Authentication a = Jenkins.getAuthentication();
  if (a == ACL.SYSTEM)
    interrupt(result, forShutdown, new CauseOfInterruption[0]);
  else {
    // worth recording who did it
    // avoid using User.get() to avoid deadlock.
    interrupt(result, forShutdown, new UserInterruption(a.getName()));
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
   * When one of the work unit is aborted, call this method to abort all the other work units.
   */
  public synchronized void abort(Throwable cause) {
    if (cause==null)        throw new IllegalArgumentException();
    if (aborted!=null)      return; // already aborted    
    aborted = cause;
    startLatch.abort(cause);
    endLatch.abort(cause);

    Thread c = Thread.currentThread();
    for (WorkUnit wu : workUnits) {
      Executor e = wu.getExecutor();
      if (e!=null && e!=c)
        e.interrupt();
    }
  }
}

代码示例来源:origin: jenkinsci/jenkins

@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);
    }
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Stops the current build.
 *
 * @since 1.489
 */
@RequirePOST
public HttpResponse doStop() {
  lock.writeLock().lock(); // need write lock as interrupt will change the field
  try {
    if (executable != null) {
      getParentOf(executable).getOwnerTask().checkAbortPermission();
      interrupt();
    }
  } finally {
    lock.writeLock().unlock();
  }
  return HttpResponses.forwardToPreviousPage();
}

代码示例来源:origin: jenkinsci/jenkins

if (item == this) {
      buildsInProgress.put(e, e.getCurrentExecutable());
      e.interrupt(Result.ABORTED);
      break;
entry.getKey().interrupt(Result.ABORTED);

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Interrupt the execution,
 * but instead of marking the build as aborted, mark it as specified result.
 *
 * @since 1.417
 */
public void interrupt(Result result) {
  interrupt(result, false);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Interrupt all {@link Executor}s.
 */
public void interrupt() {
  for (Executor e : executors) {
    e.interrupt();
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Interrupt the execution. Mark the cause and the status accordingly.
 */
public void interrupt(Result result, CauseOfInterruption... causes) {
  interrupt(result, false, causes);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Interrupt all {@link Executor}s.
 */
public void interrupt() {
  for (Executor e : executors) {
    e.interrupt();
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * For testing only. Simulate a fatal unexpected failure.
 */
public void killHard() {
  induceDeath = true;
  interrupt();
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * For testing only. Simulate a fatal unexpected failure.
 */
public void killHard() {
  induceDeath = true;
  interrupt();
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Interrupt all {@link Executor}s.
 */
public void interrupt() {
  for (Executor e : executors) {
    e.interrupt();
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Override
  public void run() {
    for( Executor e : executors )
      if(e.isIdle())
        e.interrupt();
  }
});

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Stops the current build.
 */
public void doStop( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  Queue.Executable e = executable;
  if(e!=null) {
    Tasks.getOwnerTaskOf(getParentOf(e)).checkAbortPermission();
    interrupt();
  }
  rsp.forwardToPreviousPage(req);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Stops the current build.
 */
public void doStop( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  Queue.Executable e = executable;
  if(e!=null) {
    Tasks.getOwnerTaskOf(getParentOf(e)).checkAbortPermission();
    interrupt();
  }
  rsp.forwardToPreviousPage(req);
}

相关文章