本文整理了Java中hudson.model.Node.toComputer()
方法的一些代码示例,展示了Node.toComputer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.toComputer()
方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:toComputer
[英]Gets the corresponding Computer object.
[中]获取相应的计算机对象。
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the current channel, if the node is connected and online, or null.
*
* This is just a convenience method for {@link Computer#getChannel()} with null check.
*/
@CheckForNull
public final VirtualChannel getChannel() {
Computer c = toComputer();
return c==null ? null : c.getChannel();
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected int run() throws Exception {
node.toComputer().waitUntilOnline();
return 0;
}
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected int run() throws Exception {
node.toComputer().waitUntilOffline();
return 0;
}
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected int run() throws IOException, ServletException {
node.toComputer().updateByXml(stdin);
return 0;
}
}
代码示例来源:origin: jenkinsci/jenkins
public Builder with(@CheckForNull Node node) {
if (node != null) {
return with(node.toComputer());
}
return this;
}
代码示例来源:origin: jenkinsci/jenkins
public String getShortDescription() {
String name = (node.toComputer() != null) ? node.toComputer().getDisplayName() : node.getDisplayName();
return Messages.Queue_NodeOffline(name);
}
代码示例来源:origin: jenkinsci/jenkins
public String getShortDescription() {
String name = (node.toComputer() != null) ? node.toComputer().getDisplayName() : node.getDisplayName();
return Messages.Queue_WaitingForNextAvailableExecutorOn(name);
}
代码示例来源:origin: jenkinsci/jenkins
node.toComputer().doDoDelete();
} catch (Exception e) {
if(hs.size() == 1) {
代码示例来源:origin: jenkinsci/jenkins
@Override
public String getShortDescription() {
Computer computer = node.toComputer();
String name = computer != null ? computer.getDisplayName() : node.getDisplayName();
return Messages.Node_BecauseNodeIsNotAcceptingTasks(name);
}
代码示例来源:origin: jenkinsci/jenkins
public String getSearchUrl() {
Computer c = toComputer();
if (c != null) {
return c.getUrl();
}
return "computer/" + Util.rawEncode(getNodeName());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns true if all the nodes of this label is offline.
*/
@Exported
public boolean isOffline() {
for (Node n : getNodes()) {
Computer c = n.toComputer();
if(c != null && !c.isOffline())
return false;
}
return true;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Number of busy {@link Executor}s that are carrying out some work right now.
*/
@Exported
public int getBusyExecutors() {
int r=0;
for (Node n : getNodes()) {
Computer c = n.toComputer();
if(c!=null && c.isOnline())
r += c.countBusy();
}
return r;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Number of total {@link Executor}s that belong to this label that are functioning.
* <p>
* This excludes executors that belong to offline nodes.
*/
@Exported
public int getTotalExecutors() {
int r=0;
for (Node n : getNodes()) {
Computer c = n.toComputer();
if(c!=null && c.isOnline())
r += c.countExecutors();
}
return r;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void run() {
Computer c = node.toComputer();
if (c != null) {
c.recordTermination();
c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved()));
}
if (node == nodes.remove(node.getNodeName())) {
jenkins.updateComputerList();
jenkins.trimLabels();
}
}
});
代码示例来源:origin: jenkinsci/jenkins
/**
* Number of idle {@link Executor}s that can start working immediately.
*/
@Exported
public int getIdleExecutors() {
int r=0;
for (Node n : getNodes()) {
Computer c = n.toComputer();
if(c!=null && (c.isOnline() || c.isConnecting()) && c.isAcceptingTasks())
r += c.countIdle();
}
return r;
}
代码示例来源:origin: jenkinsci/jenkins
private WorkspaceOfflineReason workspaceOffline(R build) throws IOException, InterruptedException {
FilePath ws = build.getWorkspace();
Label label = getAssignedLabel();
if (isAllSuitableNodesOffline(build)) {
Collection<Cloud> applicableClouds = label == null ? Jenkins.getInstance().clouds : label.getClouds();
return applicableClouds.isEmpty() ? WorkspaceOfflineReason.all_suitable_nodes_are_offline : WorkspaceOfflineReason.use_ondemand_slave;
}
if (ws==null || !ws.exists()) {
return WorkspaceOfflineReason.nonexisting_workspace;
}
Node builtOn = build.getBuiltOn();
if (builtOn == null) { // node built-on doesn't exist anymore
return WorkspaceOfflineReason.builton_node_gone;
}
if (builtOn.toComputer() == null) { // node still exists, but has 0 executors - o.s.l.t.
return WorkspaceOfflineReason.builton_node_no_executors;
}
return null;
}
代码示例来源:origin: jenkinsci/jenkins
public static String encodeTo(Node node) {
Computer c = node.toComputer();
if (c != null) {
return encodeTo("/" + c.getUrl(), node.getDisplayName());
}
String nodePath = node == Jenkins.getInstance() ? "(master)" : node.getNodeName();
return encodeTo("/computer/" + nodePath, node.getDisplayName());
}
代码示例来源:origin: jenkinsci/jenkins
final Computer computer = node.toComputer();
if (computer != null) {
代码示例来源:origin: jenkinsci/jenkins
/**
* Adds a node
*
* @since 1.513
*/
public ContextMenu add(Node n) {
Computer c = n.toComputer();
return add(new MenuItem()
.withDisplayName(n.getDisplayName())
.withStockIcon((c==null) ? "computer.png" : c.getIcon())
.withContextRelativeUrl(n.getSearchUrl()));
}
代码示例来源:origin: jenkinsci/jenkins
if(canRoam) {
for (Node n : Jenkins.getInstance().getNodes()) {
Computer c = n.toComputer();
if (c != null && c.isOnline() && c.isAcceptingTasks() && n.getMode() == Mode.NORMAL) {
内容来源于网络,如有侵权,请联系作者删除!