gpt4 book ai didi

java - Jenkins 管道连接 JPPF 节点

转载 作者:行者123 更新时间:2023-11-30 12:08:46 25 4
gpt4 key购买 nike

我在一个使用 Jenkins 和 JPPF 的项目中工作。如何获取哪个节点连接到 JPPF 服务器?如果可能的话,请给我指南的详细信息。谢谢,

最佳答案

免责声明:此处为 JPPF 开发人员。

您可以使用 JMX-based server management APIs 监控连接到 JPPF 服务器的节点.您可以监控很多事情,并且可以从服务器和节点获取很多不同的信息。希望以下示例能为您提供一个良好的起点:

// connect using a JMX remote connection wrapper
try (JMXDriverConnectionWrapper serverJmx = new JMXDriverConnectionWrapper("jppf_server_host", 11111)) {
serverJmx.connectAndWait(5_000L);
if (serverJmx.isConnected()) {
// get summary information on all the connected nodes
Collection<JPPFManagementInfo> nodeInfos = serverJmx.nodesInformation();
System.out.println("there are " + nodeInfos.size() + " connected nodes:");
for (JPPFManagementInfo info: nodeInfos) {
System.out.println("node uuid: " + info.getUuid() + ", host is " + info.getHost());
}

// get detailed information on the nodes
// the node forwarder will send the same request to all selected nodes
// and group the results in a map where each key is a node uuid
JPPFNodeForwardingMBean forwarder = serverJmx.getNodeForwarder();
Map<String, Object> responses = forwarder.systemInformation(NodeSelector.ALL_NODES);
for (Map.Entry<String, Object> response: responses.entrySet()) {
String nodeUuid = response.getKey();
if (response.getValue() instanceof Exception) {
System.out.println("node with uuid = " + nodeUuid + " raised an exception:");
((Exception) response.getValue()).printStackTrace(System.out);
} else {
JPPFSystemInformation systemInfo = (JPPFSystemInformation) response.getValue();
System.out.println("system properties for node uuid " + nodeUuid + " :");
System.out.println(systemInfo.getSystem());
}
}

} else {
System.out.println("could not connect to jppf_server_host:11111");
}
} catch (Exception e) {
e.printStackTrace();
}

请注意 webstandalone建立在相同管理 API 之上的管理控制台也将提供此信息。

关于java - Jenkins 管道连接 JPPF 节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54194530/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com