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

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

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

Jenkins.getSlaveAgentPort介绍

暂无

代码示例

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

public int getSlaveAgentPort() {
  return Jenkins.getInstance().getSlaveAgentPort();
}

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

@Override
protected void doAperiodicRun() {
  if (isActive) {
    try {
      if (originThread.isAlive()) {
        originThread.interrupt();
      }
      int port = Jenkins.getInstance().getSlaveAgentPort();
      if (port != -1) {
        new TcpSlaveAgentListener(port).start();
        LOGGER.log(Level.INFO, "Restarted TcpSlaveAgentListener");
      } else {
        LOGGER.log(Level.SEVERE, "Uncaught exception in TcpSlaveAgentListener " + originThread + ". Port is disabled, not rescheduling", cause);
      }
      isActive = false;
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not reschedule TcpSlaveAgentListener - trying again.", cause);
    }
  }
}

代码示例来源:origin: jenkinsci/configuration-as-code-plugin

@Test
@ConfiguredWithCode("Primitives.yml")
public void jenkins_primitive_attributes() throws Exception {
  final Jenkins jenkins = Jenkins.getInstance();
  assertEquals(6666, jenkins.getSlaveAgentPort());
}

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

public int getSlaveAgentPort() {
  return Jenkins.getInstance().getSlaveAgentPort();
}

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

@Override
protected void doAperiodicRun() {
  if (isActive) {
    try {
      if (originThread.isAlive()) {
        originThread.interrupt();
      }
      int port = Jenkins.getInstance().getSlaveAgentPort();
      if (port != -1) {
        new TcpSlaveAgentListener(port).start();
        LOGGER.log(Level.INFO, "Restarted TcpSlaveAgentListener");
      } else {
        LOGGER.log(Level.SEVERE, "Uncaught exception in TcpSlaveAgentListener " + originThread + ". Port is disabled, not rescheduling", cause);
      }
      isActive = false;
    } catch (IOException e) {
      LOGGER.log(Level.SEVERE, "Could not reschedule TcpSlaveAgentListener - trying again.", cause);
    }
  }
}

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

public FormValidation doCheckUseJnlp(@QueryParameter final String value,
    @QueryParameter final String preExistingJenkinsUser, @QueryParameter final String initScriptId) {
  if (Boolean.valueOf(Util.fixEmptyAndTrim(value)).booleanValue()) {
    if (null == Jenkins.getInstance().getTcpSlaveAgentListener() || -1 == Jenkins.getInstance().getSlaveAgentPort()) {
      return FormValidation.error("This feature cannot work, because the JNLP port is disabled in global security.");
    }
    final Set<String> aps = Jenkins.getInstance().getAgentProtocols();
    if (!(aps.contains("JNLP-connect") || aps.contains("JNLP2-connect") || aps.contains("JNLP3-connect"))) {
      return FormValidation.error("This feature cannot work, because all JNLP protocols are disabled in global security.");
    }
    if (!Boolean.valueOf(Util.fixEmptyAndTrim(preExistingJenkinsUser)).booleanValue()) {
      return FormValidation.error("Jenkins user provisioning relies on posix system, accessible via SSH.");
    }
    if (!ConfigHelper.getConfig(initScriptId).isEmpty()) {
      return FormValidation.error("Init script functionality relies on a posix system, accessible via SSH.");
    }
  }
  return FormValidation.ok();
}

相关文章

Jenkins类方法