org.apache.karaf.cellar.core.Node.getPort()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.apache.karaf.cellar.core.Node.getPort()方法的一些代码示例,展示了Node.getPort()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getPort()方法的具体详情如下:
包路径:org.apache.karaf.cellar.core.Node
类名称:Node
方法名:getPort

Node.getPort介绍

[英]Get the port number of the node.
[中]获取节点的端口号。

代码示例

代码示例来源:origin: org.apache.karaf.cellar/org.apache.karaf.cellar.hazelcast

  1. @Override
  2. public TabularData getNodes() throws Exception {
  3. CompositeType nodeType = new CompositeType("Node", "Karaf Cellar cluster node",
  4. new String[]{ "id", "alias", "hostname", "port", "local" },
  5. 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" },
  6. new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN });
  7. TabularType tableType = new TabularType("Nodes", "Table of all Karaf Cellar nodes", nodeType, new String[]{ "id" });
  8. TabularData table = new TabularDataSupport(tableType);
  9. Set<Node> nodes = clusterManager.listNodes();
  10. for (Node node : nodes) {
  11. boolean local = (node.equals(clusterManager.getNode()));
  12. CompositeData data = new CompositeDataSupport(nodeType,
  13. new String[]{ "id", "alias", "hostname", "port", "local" },
  14. new Object[]{ node.getId(), node.getAlias(), node.getHost(), node.getPort(), local });
  15. table.put(data);
  16. }
  17. return table;
  18. }

代码示例来源:origin: apache/karaf-cellar

  1. @Override
  2. public TabularData getNodes() throws Exception {
  3. CompositeType nodeType = new CompositeType("Node", "Karaf Cellar cluster node",
  4. new String[]{ "id", "alias", "hostname", "port", "local" },
  5. 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" },
  6. new OpenType[]{ SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.BOOLEAN });
  7. TabularType tableType = new TabularType("Nodes", "Table of all Karaf Cellar nodes", nodeType, new String[]{ "id" });
  8. TabularData table = new TabularDataSupport(tableType);
  9. Set<Node> nodes = clusterManager.listNodes();
  10. for (Node node : nodes) {
  11. boolean local = (node.equals(clusterManager.getNode()));
  12. CompositeData data = new CompositeDataSupport(nodeType,
  13. new String[]{ "id", "alias", "hostname", "port", "local" },
  14. new Object[]{ node.getId(), node.getAlias(), node.getHost(), node.getPort(), local });
  15. table.put(data);
  16. }
  17. return table;
  18. }

代码示例来源:origin: apache/karaf-cellar

  1. @Override
  2. protected Object doExecute() throws Exception {
  3. Set<Node> nodes = clusterManager.listNodes();
  4. if (nodes != null && !nodes.isEmpty()) {
  5. ShellTable table = new ShellTable();
  6. table.column(" ");
  7. table.column("Id");
  8. table.column("Alias");
  9. table.column("Host Name");
  10. table.column("Port");
  11. for (Node node : nodes) {
  12. String local = "";
  13. if (node.equals(clusterManager.getNode()))
  14. local = "x";
  15. table.addRow().addContent(local, node.getId(), node.getAlias(), node.getHost(), node.getPort());
  16. }
  17. table.print(System.out);
  18. } else {
  19. System.err.println("No node found in the cluster");
  20. }
  21. return null;
  22. }

相关文章