本文整理了Java中jenkins.model.Jenkins.getComputer()
方法的一些代码示例,展示了Jenkins.getComputer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getComputer()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getComputer
暂无
代码示例来源:origin: jenkinsci/jenkins
@Override
public boolean owns(String clientName) {
Computer computer = Jenkins.get().getComputer(clientName);
return computer != null;
}
代码示例来源:origin: jenkinsci/jenkins
public Computer getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
return Jenkins.getInstance().getComputer(token);
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void run() {
for (NodeMonitor nm : Jenkins.getInstance().getComputer().getMonitors()) {
nm.triggerUpdate();
}
}
};
代码示例来源:origin: jenkinsci/jenkins
computer = jenkins.getComputer(node_s);
代码示例来源:origin: jenkinsci/jenkins
computer = jenkins.getComputer(node_s);
代码示例来源:origin: jenkinsci/jenkins
Computer computer = jenkins.getComputer(node_s);
if (computer == null) {
if (names == null) {
代码示例来源:origin: jenkinsci/jenkins
computer = jenkins.getComputer(node_s);
if (computer == null) {
if (names == null) {
代码示例来源:origin: jenkinsci/jenkins
/**
* Used for CLI binding.
*/
@CLIResolver
public static Computer resolveForCLI(
@Argument(required=true,metaVar="NAME",usage="Agent name, or empty string for master") String name) throws CmdLineException {
Jenkins h = Jenkins.getInstance();
Computer item = h.getComputer(name);
if (item==null) {
List<String> names = ComputerSet.getComputerNames();
String adv = EditDistance.findNearest(name, names);
throw new IllegalArgumentException(adv == null ?
hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(name) :
hudson.model.Messages.Computer_NoSuchSlaveExists(name, adv));
}
return item;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void afterProperties(@NonNull JnlpConnectionState event) {
String clientName = event.getProperty(JnlpConnectionState.CLIENT_NAME_KEY);
SlaveComputer computer = (SlaveComputer) Jenkins.get().getComputer(clientName);
if (computer == null) {
event.reject(new ConnectionRefusalException(String.format("%s is not a JNLP agent", clientName)));
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public boolean owns(String clientName) {
Computer computer = Jenkins.getInstance().getComputer(clientName);
return computer != null;
}
代码示例来源:origin: org.jenkins-ci.plugins.workflow/workflow-durable-task-step
@SuppressFBWarnings(value="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE", justification="TODO 1.653+ switch to Jenkins.getInstanceOrNull")
@Override
protected Computer tryResolve() {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
return j.getComputer(slave);
}
@Override public String toString() {
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
public Computer getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
return Jenkins.getInstance().getComputer(token);
}
代码示例来源:origin: org.jenkins-ci.plugins/scriptler
private List<String> getSlaveNames() {
ComputerSet computers = Jenkins.getInstance().getComputer();
List<String> slaveNames = computers.get_slaveNames();
// slaveNames is unmodifiable, therefore create a new list
List<String> slaves = new ArrayList<String>();
slaves.addAll(slaveNames);
return slaves;
}
代码示例来源:origin: openstack-infra/gearman-plugin
public static String getRealName(Computer computer) {
if (Jenkins.getActiveInstance().getComputer("") == computer) {
return "master";
} else {
return computer.getName();
}
}
代码示例来源:origin: org.jenkins-ci.plugins/nodelabelparameter
protected Computer getComputer(Node node) {
String name = Constants.MASTER.equals(node.getNodeName()) ? "" : node.getNodeName();
return Jenkins.getInstance().getComputer(name);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public void run() {
for (NodeMonitor nm : Jenkins.getInstance().getComputer().getMonitors()) {
nm.triggerUpdate();
}
}
};
代码示例来源:origin: org.jenkins-ci.plugins/nodelabelparameter
public boolean isEligible(String nodeName) {
Node node = Jenkins.getInstance().getNode(nodeName);
if (node == null && (Constants.MASTER.equals(nodeName) || "".equals(nodeName))) {
node = Jenkins.getInstance().getComputer("").getNode();
}
return isEligible(node);
}
代码示例来源:origin: openstack-infra/zmq-event-publisher
public RunListenerImpl() {
super(Run.class);
ZMQRunner = new ZMQRunnable(queue);
thread = threadFactory.newThread(ZMQRunner);
thread.start();
Computer master = null;
String hostname = null;
// query Jenkins for master's name
try {
master = Jenkins.getInstance().getComputer("");
if (master != null) {
hostname = master.getHostName();
}
else {
// master node may not be enabled so get masterName from system
hostname = java.net.InetAddress.getLocalHost().getHostName();
}
} catch (Exception e) {
}
masterName = hostname;
}
代码示例来源:origin: org.jenkins-ci.plugins/nodelabelparameter
/**
* Checks whether the given node is available for an execution of the job,
*
* @param nodeName
* the name of the node to check
* @return <code>true</code> if the job is ok to be used
*/
public static boolean isNodeOnline(String nodeName) {
if (Constants.MASTER.equals(nodeName)) {
return true;
}
final Computer c = Jenkins.getInstance().getComputer(nodeName);
if (c != null) {
Node n = c.getNode();
// really check if the node is available for execution
return n != null && c.isOnline() && c.getNumExecutors() > 0;
}
return false;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Used for CLI binding.
*/
@CLIResolver
public static Computer resolveForCLI(
@Argument(required=true,metaVar="NAME",usage="Agent name, or empty string for master") String name) throws CmdLineException {
Jenkins h = Jenkins.getInstance();
Computer item = h.getComputer(name);
if (item==null) {
List<String> names = ComputerSet.getComputerNames();
String adv = EditDistance.findNearest(name, names);
throw new IllegalArgumentException(adv == null ?
hudson.model.Messages.Computer_NoSuchSlaveExistsWithoutAdvice(name) :
hudson.model.Messages.Computer_NoSuchSlaveExists(name, adv));
}
return item;
}
内容来源于网络,如有侵权,请联系作者删除!