jenkins.model.Jenkins.isTerminating()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(135)

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

Jenkins.isTerminating介绍

[英]Returns true if the container initiated the termination of the web application.
[中]如果容器启动了web应用程序的终止,则返回true。

代码示例

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

private boolean terminating() {
  return Jenkins.getInstance().isTerminating();
}

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

/**
 * During Jenkins start-up, before {@link InitMilestone#PLUGINS_STARTED} the extensions lists will be empty
 * and they are not guaranteed to be fully populated until after {@link InitMilestone#EXTENSIONS_AUGMENTED},
 * similarly, during termination after {@link Jenkins#isTerminating()} is set, it is no longer safe to access
 * the extensions lists.
 * If you attempt to access the extensions list from a UI thread while the extensions are being loaded you will
 * hit a big honking great monitor lock that will block until the effective extension list has been determined
 * (as if a plugin fails to start, all of the failed plugin's extensions and any dependent plugins' extensions
 * will have to be evicted from the list of extensions. In practical terms this only affects the
 * "Jenkins is loading" screen, but as that screen uses the generic layouts we provide this utility method
 * so that the generic layouts can avoid iterating extension lists while Jenkins is starting up.
 * If you attempt to access the extensions list from a UI thread while Jenkins is being shut down, the extensions
 * themselves may no longer be in a valid state and could attempt to revive themselves and block termination.
 * In actual terms the termination only affects those views required to render {@link HudsonIsRestarting}'s
 * {@code index.jelly} which is the same set as the {@link HudsonIsLoading} pages so it makes sense to
 * use both checks here.
 *
 * @return {@code true} if the extensions lists have been populated.
 * @since 1.607
 */
public static boolean isExtensionsAvailable() {
  final Jenkins jenkins = Jenkins.getInstanceOrNull();
  return jenkins != null && jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0
      && !jenkins.isTerminating();
}

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

private boolean terminating() {
  return Jenkins.getInstance().isTerminating();
}

代码示例来源:origin: Netflix-Skunkworks/dynaslave-plugin

@Override
public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
  if (!Jenkins.getInstance().isTerminating()) {
    try {
      Jenkins.getInstance().removeNode(computer.getNode());
    } catch (IOException e) {
      LOG.log(Level.WARNING, "Error removing slave", e);
    }
  }
}

代码示例来源:origin: jenkinsci/openstack-cloud-plugin

@Override
public Collection<NodeProvisioner.PlannedNode> provision(Label label, int excessWorkload) {
  Queue<JCloudsSlaveTemplate> templateProvider = getAvailableTemplateProvider(label);
  List<PlannedNode> plannedNodeList = new ArrayList<>();
  while (excessWorkload > 0 && !Jenkins.getActiveInstance().isQuietingDown() && !Jenkins.getActiveInstance().isTerminating()) {
    final JCloudsSlaveTemplate template = templateProvider.poll();
    if (template == null) {
      LOGGER.info("Instance cap exceeded on all available templates");
      break;
    }
    LOGGER.fine("Provisioning slave for " + label + " from template " + template.name);
    int numExecutors = template.getEffectiveSlaveOptions().getNumExecutors();
    ProvisioningActivity.Id id = new ProvisioningActivity.Id(this.name, template.name);
    Future<Node> task = Computer.threadPoolForRemoting.submit(new NodeCallable(this, template, id));
    plannedNodeList.add(new TrackedPlannedNode(id, numExecutors, task));
    excessWorkload -= numExecutors;
  }
  return plannedNodeList;
}

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

/**
 * During Jenkins start-up, before {@link InitMilestone#PLUGINS_STARTED} the extensions lists will be empty
 * and they are not guaranteed to be fully populated until after {@link InitMilestone#EXTENSIONS_AUGMENTED},
 * similarly, during termination after {@link Jenkins#isTerminating()} is set, it is no longer safe to access
 * the extensions lists.
 * If you attempt to access the extensions list from a UI thread while the extensions are being loaded you will
 * hit a big honking great monitor lock that will block until the effective extension list has been determined
 * (as if a plugin fails to start, all of the failed plugin's extensions and any dependent plugins' extensions
 * will have to be evicted from the list of extensions. In practical terms this only affects the
 * "Jenkins is loading" screen, but as that screen uses the generic layouts we provide this utility method
 * so that the generic layouts can avoid iterating extension lists while Jenkins is starting up.
 * If you attempt to access the extensions list from a UI thread while Jenkins is being shut down, the extensions
 * themselves may no longer be in a valid state and could attempt to revive themselves and block termination.
 * In actual terms the termination only affects those views required to render {@link HudsonIsRestarting}'s
 * {@code index.jelly} which is the same set as the {@link HudsonIsLoading} pages so it makes sense to
 * use both checks here.
 *
 * @return {@code true} if the extensions lists have been populated.
 * @since 1.607
 */
public static boolean isExtensionsAvailable() {
  final Jenkins jenkins = Jenkins.getInstanceOrNull();
  return jenkins != null && jenkins.getInitLevel().compareTo(InitMilestone.EXTENSIONS_AUGMENTED) >= 0
      && !jenkins.isTerminating();
}

代码示例来源:origin: jenkinsci/jclouds-plugin

List<PlannedNode> plannedNodeList = new ArrayList<PlannedNode>();
while (excessWorkload > 0 && !Jenkins.getInstance().isQuietingDown() && !Jenkins.getInstance().isTerminating()) {

相关文章

Jenkins类方法