Add hostname to nodeinfo(#6156)

This commit is contained in:
ashione
2019-11-19 15:03:46 +08:00
committed by Qing Wang
parent f9d2d106b1
commit a1744f67fe
5 changed files with 16 additions and 4 deletions
@@ -12,14 +12,17 @@ public class NodeInfo {
public final String nodeAddress;
public final String nodeHostname;
public final boolean isAlive;
public final Map<String, Double> resources;
public NodeInfo(UniqueId nodeId, String nodeAddress,
public NodeInfo(UniqueId nodeId, String nodeAddress, String nodeHostname,
boolean isAlive, Map<String, Double> resources) {
this.nodeId = nodeId;
this.nodeAddress = nodeAddress;
this.nodeHostname = nodeHostname;
this.isAlive = isAlive;
this.resources = resources;
}
@@ -28,6 +31,7 @@ public class NodeInfo {
return "NodeInfo{"
+ "nodeId='" + nodeId + '\''
+ ", nodeAddress='" + nodeAddress + "\'"
+ ", nodeHostname'" + nodeHostname + "\'"
+ ", isAlive=" + isAlive
+ ", resources=" + resources
+ "}";
@@ -77,12 +77,14 @@ public class GcsClient {
if (data.getState() == GcsNodeInfo.GcsNodeState.ALIVE) {
//Code path of node insertion.
NodeInfo nodeInfo = new NodeInfo(
nodeId, data.getNodeManagerAddress(), true, new HashMap<>());
nodeId, data.getNodeManagerAddress(),
data.getNodeManagerHostname(),
true, new HashMap<>());
nodes.put(nodeId, nodeInfo);
} else {
// Code path of node deletion.
NodeInfo nodeInfo = new NodeInfo(nodeId, nodes.get(nodeId).nodeAddress,
false, new HashMap<>());
nodes.get(nodeId).nodeHostname, false, new HashMap<>());
nodes.put(nodeId, nodeInfo);
}
}