hudson.model.Hudson.getComputers()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(107)

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

Hudson.getComputers介绍

[英]Gets the read-only list of all Computers.
[中]获取所有计算机的只读列表。

代码示例

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

@Exported(name="computer",inline=true)
public Computer[] get_all() {
  return Hudson.getInstance().getComputers();
}

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

@Exported(name="computer",inline=true)
public Computer[] get_all() {
  return Hudson.getInstance().getComputers();
}

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

@Exported(name="computer",inline=true)
public Computer[] get_all() {
  return Hudson.getInstance().getComputers();
}

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

@Exported(name = "computer", inline = true)
public Computer[] get_all() {
  return Hudson.getInstance().getComputers();
}

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

/**
   * {@inheritDoc}
   */
  @SuppressWarnings("unchecked")
  protected void doRun() {
    final long startRun = System.currentTimeMillis();
    for (Computer c : Hudson.getInstance().getComputers()) {
      Node n = c.getNode();
      if (n!=null && n.isHoldOffLaunchUntilSave())
        continue;
      if (!nextCheck.containsKey(c) || startRun > nextCheck.get(c)) {
        // at the moment I don't trust strategies to wait more than 60 minutes
        // strategies need to wait at least one minute
        final long waitInMins = Math.min(1, Math.max(60, c.getRetentionStrategy().check(c)));
        nextCheck.put(c, startRun + waitInMins*1000*60 /*MINS->MILLIS*/);
      }
    }
  }
}

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

/**
   * {@inheritDoc}
   */
  @SuppressWarnings("unchecked")
  protected void doRun() {
    final long startRun = System.currentTimeMillis();
    for (Computer c : Hudson.getInstance().getComputers()) {
      Node n = c.getNode();
      if (n!=null && n.isHoldOffLaunchUntilSave())
        continue;
      if (!nextCheck.containsKey(c) || startRun > nextCheck.get(c)) {
        // at the moment I don't trust strategies to wait more than 60 minutes
        // strategies need to wait at least one minute
        final long waitInMins = Math.min(1, Math.max(60, c.getRetentionStrategy().check(c)));
        nextCheck.put(c, startRun + waitInMins*1000*60 /*MINS->MILLIS*/);
      }
    }
  }
}

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

/**
   * {@inheritDoc}
   */
  @SuppressWarnings("unchecked")
  protected void doRun() {
    final long startRun = System.currentTimeMillis();
    for (Computer c : Hudson.getInstance().getComputers()) {
      Node n = c.getNode();
      if (n!=null && n.isHoldOffLaunchUntilSave())
        continue;
      if (!nextCheck.containsKey(c) || startRun > nextCheck.get(c)) {
        // at the moment I don't trust strategies to wait more than 60 minutes
        // strategies need to wait at least one minute
        final long waitInMins = Math.min(1, Math.max(60, c.getRetentionStrategy().check(c)));
        nextCheck.put(c, startRun + waitInMins*1000*60 /*MINS->MILLIS*/);
      }
    }
  }
}

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

/**
 * If this {@link Launcher} is encapsulating an execution on a specific {@link Computer},
 * return it.
 *
 * <p>
 * Because of the way internal Hudson abstractions are set up (that is, {@link Launcher} only
 * needs a {@link VirtualChannel} to do its job and isn't really required that the channel
 * comes from an existing {@link Computer}), this method may not always the right {@link Computer} instance.
 *
 * @return
 *      null if this launcher is not created from a {@link Computer} object.
 * @deprecated since 2008-11-16.
 *      See the javadoc for why this is inherently unreliable. If you are trying to
 *      figure out the current {@link Computer} from within a build, use
 *      {@link Computer#currentComputer()}  
 */
public Computer getComputer() {
  for( Computer c : Hudson.getInstance().getComputers() )
    if(c.getChannel()==channel)
      return c;
  return null;
}

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

/**
   * {@inheritDoc}
   */
  @SuppressWarnings("unchecked")
  protected void doRun() {
    final long startRun = System.currentTimeMillis();
    for (Computer c : Hudson.getInstance().getComputers()) {
      Node n = c.getNode();
      if (n != null && n.isHoldOffLaunchUntilSave()) {
        continue;
      }
      if (!nextCheck.containsKey(c) || startRun > nextCheck.get(c)) {
        // at the moment I don't trust strategies to wait more than 60 minutes
        // strategies need to wait at least one minute
        final long waitInMins = Math.min(1, Math.max(60, c.getRetentionStrategy().check(c)));
        nextCheck.put(c, startRun + waitInMins * 1000 * 60 /*MINS->MILLIS*/);
      }
    }
  }
}

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

/**
 * If this {@link Launcher} is encapsulating an execution on a specific {@link Computer},
 * return it.
 *
 * <p>
 * Because of the way internal Hudson abstractions are set up (that is, {@link Launcher} only
 * needs a {@link VirtualChannel} to do its job and isn't really required that the channel
 * comes from an existing {@link Computer}), this method may not always the right {@link Computer} instance.
 *
 * @return
 *      null if this launcher is not created from a {@link Computer} object.
 * @deprecated since 2008-11-16.
 *      See the javadoc for why this is inherently unreliable. If you are trying to
 *      figure out the current {@link Computer} from within a build, use
 *      {@link Computer#currentComputer()}  
 */
public Computer getComputer() {
  for( Computer c : Hudson.getInstance().getComputers() )
    if(c.getChannel()==channel)
      return c;
  return null;
}

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

/**
 * Returns true if Hudson is building something or going to build something.
 */
protected boolean isSomethingHappening() {
  if (!hudson.getQueue().isEmpty())
    return true;
  for (Computer n : hudson.getComputers())
    if (!n.isIdle())
      return true;
  return false;
}

代码示例来源:origin: org.hudsonci.plugins/instant-messaging

private int getTotalExecutors() {
    int totalExecutors = 0;
    Computer[] computers = Hudson.getInstance().getComputers();
    for (Computer compi : computers) {
      if (compi.isOnline()) {
        totalExecutors += compi.getNumExecutors();
      }
    }
    return totalExecutors;
  }
}

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

/**
 * If this {@link Launcher} is encapsulating an execution on a specific {@link Computer},
 * return it.
 *
 * <p>
 * Because of the way internal Hudson abstractions are set up (that is, {@link Launcher} only
 * needs a {@link VirtualChannel} to do its job and isn't really required that the channel
 * comes from an existing {@link Computer}), this method may not always the right {@link Computer} instance.
 *
 * @return
 *      null if this launcher is not created from a {@link Computer} object.
 * @deprecated since 2008-11-16.
 *      See the javadoc for why this is inherently unreliable. If you are trying to
 *      figure out the current {@link Computer} from within a build, use
 *      {@link Computer#currentComputer()}  
 */
public Computer getComputer() {
  for( Computer c : Hudson.getInstance().getComputers() )
    if(c.getChannel()==channel)
      return c;
  return null;
}

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

static Executor getExecutor(Run run) {
  for (Computer c : Hudson.getInstance().getComputers()) {
    for (Executor e : c.getExecutors()) {
      if (e.getCurrentExecutable() == run) {
        return e;
      }
    }
  }
  return null;
}

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

/**
 * Returns true if Hudson is building something or going to build something.
 */
protected boolean isSomethingHappening() {
  if (!hudson.getQueue().isEmpty())
    return true;
  for (Computer n : hudson.getComputers())
    if (!n.isIdle())
      return true;
  return false;
}

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

/**
 * Gets the {@link Executor} building this job, if it's being built.
 * Otherwise null.
 */
public Executor getExecutor() {
  for( Computer c : Hudson.getInstance().getComputers() ) {
    for (Executor e : c.getExecutors()) {
      if(e.getCurrentExecutable()==this)
        return e;
    }
  }
  return null;
}

代码示例来源:origin: org.hudsonci.plugins/instant-messaging

private int getBusyExecutors() {
  int busyExecutors = 0;
  //boolean stillRunningExecutorFound = false;
  Computer[] computers = Hudson.getInstance().getComputers();
  for (Computer compi : computers) {
    
    for (Executor executor : compi.getExecutors()) {
      if (executor.isBusy()) {
        busyExecutors++;
      }
    }
  }
  
  return busyExecutors;
}

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

/**
 * Gets the {@link Executor} building this job, if it's being built.
 * Otherwise null.
 */
public Executor getExecutor() {
  for( Computer c : Hudson.getInstance().getComputers() ) {
    for (Executor e : c.getExecutors()) {
      if(e.getCurrentExecutable()==this)
        return e;
    }
  }
  return null;
}

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

/**
 * Returns true if Hudson is building something or going to build something.
 */
protected boolean isSomethingHappening() {
  if (!hudson.getQueue().isEmpty()) {
    return true;
  }
  for (Computer n : hudson.getComputers()) {
    if (!n.isIdle()) {
      return true;
    }
  }
  return false;
}

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

/**
 * Gets the {@link Executor} building this job, if it's being built.
 * Otherwise null.
 */
public Executor getExecutor() {
  for( Computer c : Hudson.getInstance().getComputers() ) {
    for (Executor e : c.getExecutors()) {
      if(e.getCurrentExecutable()==this)
        return e;
    }
  }
  return null;
}

相关文章

微信公众号

最新文章

更多

Hudson类方法