本文整理了Java中org.apache.karaf.cellar.core.Node.getPort()
方法的一些代码示例,展示了Node.getPort()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getPort()
方法的具体详情如下:
包路径:org.apache.karaf.cellar.core.Node
类名称:Node
方法名:getPort
[英]Get the port number of the node.
[中]获取节点的端口号。
代码示例来源:origin: org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast
@Override
public TabularData getNodes() throws Exception {
CompositeType nodeType = new CompositeType("Node", "Karaf Cellar cluster node",
new String[]{ "id", "alias", "hostname", "port", "local" },
new String[]{ "ID of the node", "Alias of the node", "Hostname of the node", "Port number of the node", "Flag defining if the node is local" },
new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN });
TabularType tableType = new TabularType("Nodes", "Table of all Karaf Cellar nodes", nodeType, new String[]{ "id" });
TabularData table = new TabularDataSupport(tableType);
Set<Node> nodes = clusterManager.listNodes();
for (Node node : nodes) {
boolean local = (node.equals(clusterManager.getNode()));
CompositeData data = new CompositeDataSupport(nodeType,
new String[]{ "id", "alias", "hostname", "port", "local" },
new Object[]{ node.getId(), node.getAlias(), node.getHost(), node.getPort(), local });
table.put(data);
}
return table;
}
代码示例来源:origin: apache/karaf-cellar
@Override
public TabularData getNodes() throws Exception {
CompositeType nodeType = new CompositeType("Node", "Karaf Cellar cluster node",
new String[]{ "id", "alias", "hostname", "port", "local" },
new String[]{ "ID of the node", "Alias of the node", "Hostname of the node", "Port number of the node", "Flag defining if the node is local" },
new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN });
TabularType tableType = new TabularType("Nodes", "Table of all Karaf Cellar nodes", nodeType, new String[]{ "id" });
TabularData table = new TabularDataSupport(tableType);
Set<Node> nodes = clusterManager.listNodes();
for (Node node : nodes) {
boolean local = (node.equals(clusterManager.getNode()));
CompositeData data = new CompositeDataSupport(nodeType,
new String[]{ "id", "alias", "hostname", "port", "local" },
new Object[]{ node.getId(), node.getAlias(), node.getHost(), node.getPort(), local });
table.put(data);
}
return table;
}
代码示例来源:origin: apache/karaf-cellar
@Override
protected Object doExecute() throws Exception {
Set<Node> nodes = clusterManager.listNodes();
if (nodes != null && !nodes.isEmpty()) {
ShellTable table = new ShellTable();
table.column(" ");
table.column("Id");
table.column("Alias");
table.column("Host Name");
table.column("Port");
for (Node node : nodes) {
String local = "";
if (node.equals(clusterManager.getNode()))
local = "x";
table.addRow().addContent(local, node.getId(), node.getAlias(), node.getHost(), node.getPort());
}
table.print(System.out);
} else {
System.err.println("No node found in the cluster");
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!