com.alibaba.rocketmq.common.protocol.body.ClusterInfo Java Examples
The following examples show how to use
com.alibaba.rocketmq.common.protocol.body.ClusterInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TopicListSubCommand.java From RocketMQ-Master-analyze with Apache License 2.0 | 6 votes |
private String findTopicBelongToWhichCluster(final String topic, final ClusterInfo clusterInfo, final DefaultMQAdminExt defaultMQAdminExt) throws RemotingException, MQClientException, InterruptedException { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); BrokerData brokerData = topicRouteData.getBrokerDatas().get(0); String brokerName = brokerData.getBrokerName(); Iterator<Entry<String, Set<String>>> it = clusterInfo.getClusterAddrTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, Set<String>> next = it.next(); if (next.getValue().contains(brokerName)) { return next.getKey(); } } return null; }
Example #2
Source File: TopicListSubCommand.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 6 votes |
private String findTopicBelongToWhichCluster(final String topic, final ClusterInfo clusterInfo, final DefaultMQAdminExt defaultMQAdminExt) throws RemotingException, MQClientException, InterruptedException { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); BrokerData brokerData = topicRouteData.getBrokerDatas().get(0); String brokerName = brokerData.getBrokerName(); Iterator<Entry<String, Set<String>>> it = clusterInfo.getClusterAddrTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, Set<String>> next = it.next(); if (next.getValue().contains(brokerName)) { return next.getKey(); } } return null; }
Example #3
Source File: TopicListSubCommand.java From rocketmq with Apache License 2.0 | 6 votes |
private String findTopicBelongToWhichCluster(final String topic, final ClusterInfo clusterInfo, final DefaultMQAdminExt defaultMQAdminExt) throws RemotingException, MQClientException, InterruptedException { TopicRouteData topicRouteData = defaultMQAdminExt.examineTopicRouteInfo(topic); BrokerData brokerData = topicRouteData.getBrokerDatas().get(0); String brokerName = brokerData.getBrokerName(); Iterator<Entry<String, Set<String>>> it = clusterInfo.getClusterAddrTable().entrySet().iterator(); while (it.hasNext()) { Entry<String, Set<String>> next = it.next(); if (next.getValue().contains(brokerName)) { return next.getKey(); } } return null; }
Example #4
Source File: ConsumerServiceImpl.java From rocket-console with Apache License 2.0 | 6 votes |
@Override @MultiMQAdminCmdMethod public List<ConsumerConfigInfo> examineSubscriptionGroupConfig(String group) { List<ConsumerConfigInfo> consumerConfigInfoList = Lists.newArrayList(); try { ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); for (String brokerName : fetchBrokerNameSetBySubscriptionGroup(group)) { String brokerAddress = clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(); SubscriptionGroupConfig subscriptionGroupConfig = mqAdminExt.examineSubscriptionGroupConfig(brokerAddress,group); consumerConfigInfoList.add(new ConsumerConfigInfo(Lists.newArrayList(brokerName),subscriptionGroupConfig)); } } catch (Exception e) { throw propagate(e); } return consumerConfigInfoList; }
Example #5
Source File: ClusterServiceImpl.java From rocket-console with Apache License 2.0 | 6 votes |
@Override public Map<String, Object> list() { try { Map<String, Object> resultMap = Maps.newHashMap(); ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); logger.info("op=look_clusterInfo {}", JsonUtil.obj2String(clusterInfo)); Map<String/*brokerName*/, Map<Long/* brokerId */, Object/* brokerDetail */>> brokerServer = Maps.newHashMap(); for (BrokerData brokerData : clusterInfo.getBrokerAddrTable().values()) { Map<Long, Object> brokerMasterSlaveMap = Maps.newHashMap(); for (Map.Entry<Long/* brokerId */, String/* broker address */> brokerAddr : brokerData.getBrokerAddrs().entrySet()) { KVTable kvTable = mqAdminExt.fetchBrokerRuntimeStats(brokerAddr.getValue()); // KVTable kvTable = mqAdminExt.fetchBrokerRuntimeStats("127.0.0.1:10911"); brokerMasterSlaveMap.put(brokerAddr.getKey(), kvTable.getTable()); } brokerServer.put(brokerData.getBrokerName(), brokerMasterSlaveMap); } resultMap.put("clusterInfo", clusterInfo); resultMap.put("brokerServer", brokerServer); return resultMap; } catch (Exception err) { throw Throwables.propagate(err); } }
Example #6
Source File: TopicServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public boolean deleteTopic(String topic) { ClusterInfo clusterInfo = null; try { clusterInfo = mqAdminExt.examineBrokerClusterInfo(); } catch (Exception err){ throw Throwables.propagate(err); } for(String clusterName : clusterInfo.getClusterAddrTable().keySet()){ deleteTopic(topic,clusterName); } return true; }
Example #7
Source File: CommandUtil.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public static String fetchBrokerNameByAddr(final MQAdminExt adminExt, final String addr) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); HashMap<String/* brokerName */, BrokerData> brokerAddrTable = clusterInfoSerializeWrapper.getBrokerAddrTable(); Iterator<Map.Entry<String, BrokerData>> it = brokerAddrTable.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, BrokerData> entry = it.next(); HashMap<Long, String> brokerAddrs = entry.getValue().getBrokerAddrs(); if (brokerAddrs.containsValue(addr)) return entry.getKey(); } throw new Exception( "Make sure the specified broker addr exists or the nameserver which connected is correct."); }
Example #8
Source File: CommandUtil.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public static Set<String> fetchBrokerNameByClusterName(final MQAdminExt adminExt, final String clusterName) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName); if (brokerNameSet.isEmpty()) { throw new Exception( "Make sure the specified clusterName exists or the nameserver which connected is correct."); } return brokerNameSet; }
Example #9
Source File: CommandUtil.java From RocketMQ-Master-analyze with Apache License 2.0 | 5 votes |
public static Set<String> fetchMasterAddrByClusterName(final MQAdminExt adminExt, final String clusterName) throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, MQBrokerException { Set<String> masterSet = new HashSet<String>(); ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName); if (brokerNameSet != null) { for (String brokerName : brokerNameSet) { BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName); if (brokerData != null) { String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID); if (addr != null) { masterSet.add(addr); } } } } else { System.out.printf( "[error] Make sure the specified clusterName exists or the nameserver which connected is correct."); } return masterSet; }
Example #10
Source File: CommandUtil.java From rocketmq with Apache License 2.0 | 5 votes |
public static String fetchBrokerNameByAddr(final MQAdminExt adminExt, final String addr) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); HashMap<String/* brokerName */, BrokerData> brokerAddrTable = clusterInfoSerializeWrapper.getBrokerAddrTable(); Iterator<Map.Entry<String, BrokerData>> it = brokerAddrTable.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, BrokerData> entry = it.next(); HashMap<Long, String> brokerAddrs = entry.getValue().getBrokerAddrs(); if (brokerAddrs.containsValue(addr)) return entry.getKey(); } throw new Exception( "Make sure the specified broker addr exists or the nameserver which connected is correct."); }
Example #11
Source File: CommandUtil.java From rocketmq with Apache License 2.0 | 5 votes |
public static Set<String> fetchBrokerNameByClusterName(final MQAdminExt adminExt, final String clusterName) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName); if (brokerNameSet.isEmpty()) { throw new Exception( "Make sure the specified clusterName exists or the nameserver which connected is correct."); } return brokerNameSet; }
Example #12
Source File: CommandUtil.java From rocketmq with Apache License 2.0 | 5 votes |
public static Set<String> fetchMasterAddrByClusterName(final MQAdminExt adminExt, final String clusterName) throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, MQBrokerException { Set<String> masterSet = new HashSet<String>(); ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName); if (brokerNameSet != null) { for (String brokerName : brokerNameSet) { BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName); if (brokerData != null) { String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID); if (addr != null) { masterSet.add(addr); } } } } else { System.out .printf("[error] Make sure the specified clusterName exists or the nameserver which connected is correct."); } return masterSet; }
Example #13
Source File: TopicServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public TopicConfig examineTopicConfig(String topic, String brokerName) { ClusterInfo clusterInfo = null; try { clusterInfo = mqAdminExt.examineBrokerClusterInfo(); } catch (Exception e) { throw Throwables.propagate(e); } return mqAdminExt.examineTopicConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), topic); }
Example #14
Source File: TopicServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public void createOrUpdate(TopicConfigInfo topicCreateOrUpdateRequest) { TopicConfig topicConfig = new TopicConfig(); BeanUtils.copyProperties(topicCreateOrUpdateRequest, topicConfig); try { ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); for (String brokerName : topicCreateOrUpdateRequest.getBrokerNameList()) { mqAdminExt.createAndUpdateTopicConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), topicConfig); } } catch (Exception err) { throw Throwables.propagate(err); } }
Example #15
Source File: ConsumerServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public boolean createAndUpdateSubscriptionGroupConfig(ConsumerConfigInfo consumerConfigInfo) { try { ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); for (String brokerName : consumerConfigInfo.getBrokerNameList()) { mqAdminExt.createAndUpdateSubscriptionGroupConfig(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), consumerConfigInfo.getSubscriptionGroupConfig()); } } catch (Exception err) { throw Throwables.propagate(err); } return true; }
Example #16
Source File: ConsumerServiceImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override @MultiMQAdminCmdMethod public boolean deleteSubGroup(DeleteSubGroupRequest deleteSubGroupRequest) { try { ClusterInfo clusterInfo = mqAdminExt.examineBrokerClusterInfo(); for (String brokerName : deleteSubGroupRequest.getBrokerNameList()) { logger.info("addr={} groupName={}", clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName()); mqAdminExt.deleteSubscriptionGroup(clusterInfo.getBrokerAddrTable().get(brokerName).selectBrokerAddr(), deleteSubGroupRequest.getGroupName()); } } catch (Exception e) { throw propagate(e); } return true; }
Example #17
Source File: MQAdminExtImpl.java From rocket-console with Apache License 2.0 | 5 votes |
@Override public ClusterInfo examineBrokerClusterInfo() throws InterruptedException, MQBrokerException, RemotingTimeoutException, RemotingSendRequestException, RemotingConnectException { logger.info("I am test"); return MQAdminInstance.threadLocalMQAdminExt().examineBrokerClusterInfo(); }
Example #18
Source File: CommandUtil.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public static String fetchBrokerNameByAddr(final MQAdminExt adminExt, final String addr) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); HashMap<String/* brokerName */, BrokerData> brokerAddrTable = clusterInfoSerializeWrapper.getBrokerAddrTable(); Iterator<Map.Entry<String, BrokerData>> it = brokerAddrTable.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, BrokerData> entry = it.next(); HashMap<Long, String> brokerAddrs = entry.getValue().getBrokerAddrs(); if (brokerAddrs.containsValue(addr)) return entry.getKey(); } throw new Exception( "Make sure the specified broker addr exists or the nameserver which connected is correct."); }
Example #19
Source File: CommandUtil.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public static Set<String> fetchBrokerNameByClusterName(final MQAdminExt adminExt, final String clusterName) throws Exception { ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName); if (brokerNameSet.isEmpty()) { throw new Exception( "Make sure the specified clusterName exists or the nameserver which connected is correct."); } return brokerNameSet; }
Example #20
Source File: CommandUtil.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 5 votes |
public static Set<String> fetchMasterAddrByClusterName(final MQAdminExt adminExt, final String clusterName) throws InterruptedException, RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, MQBrokerException { Set<String> masterSet = new HashSet<String>(); ClusterInfo clusterInfoSerializeWrapper = adminExt.examineBrokerClusterInfo(); Set<String> brokerNameSet = clusterInfoSerializeWrapper.getClusterAddrTable().get(clusterName); if (brokerNameSet != null) { for (String brokerName : brokerNameSet) { BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName); if (brokerData != null) { String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID); if (addr != null) { masterSet.add(addr); } } } } else { System.out .printf("[error] Make sure the specified clusterName exists or the nameserver which connected is correct."); } return masterSet; }
Example #21
Source File: RouteInfoManager.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example #22
Source File: RouteInfoManager.java From rocketmq with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example #23
Source File: ClusterListSubCommand.java From rocketmq with Apache License 2.0 | 4 votes |
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException { ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo(); System.out.printf("%-16s %-32s %14s %14s %14s %14s%n",// "#Cluster Name",// "#Broker Name",// "#InTotalYest",// "#OutTotalYest",// "#InTotalToday",// "#OutTotalToday"// ); Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator(); while (itCluster.hasNext()) { Map.Entry<String, Set<String>> next = itCluster.next(); String clusterName = next.getKey(); TreeSet<String> brokerNameSet = new TreeSet<String>(); brokerNameSet.addAll(next.getValue()); for (String brokerName : brokerNameSet) { BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName); if (brokerData != null) { Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator(); while (itAddr.hasNext()) { Map.Entry<Long, String> next1 = itAddr.next(); long InTotalYest = 0; long OutTotalYest = 0; long InTotalToday = 0; long OutTotalToday = 0; try { KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue()); String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning"); String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning"); String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow"); String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning"); String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning"); String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow"); InTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning); OutTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning); InTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning); OutTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning); } catch (Exception e) { } System.out.printf("%-16s %-32s %14d %14d %14d %14d%n",// clusterName,// brokerName,// InTotalYest,// OutTotalYest,// InTotalToday,// OutTotalToday// ); } } } if (itCluster.hasNext()) { System.out.println(""); } } }
Example #24
Source File: RouteInfoManager.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
public byte[] getAllClusterInfo() { ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo(); clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable); clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable); return clusterInfoSerializeWrapper.encode(); }
Example #25
Source File: ClusterListSubCommand.java From RocketMQ-Master-analyze with Apache License 2.0 | 4 votes |
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException { ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo(); System.out.printf("%-16s %-32s %14s %14s %14s %14s\n", // "#Cluster Name", // "#Broker Name", // "#InTotalYest", // "#OutTotalYest", // "#InTotalToday", // "#OutTotalToday"// ); Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator(); while (itCluster.hasNext()) { Map.Entry<String, Set<String>> next = itCluster.next(); String clusterName = next.getKey(); TreeSet<String> brokerNameSet = new TreeSet<String>(); brokerNameSet.addAll(next.getValue()); for (String brokerName : brokerNameSet) { BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName); if (brokerData != null) { Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator(); while (itAddr.hasNext()) { Map.Entry<Long, String> next1 = itAddr.next(); long InTotalYest = 0; long OutTotalYest = 0; long InTotalToday = 0; long OutTotalToday = 0; try { KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue()); String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning"); String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning"); String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow"); String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning"); String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning"); String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow"); InTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning); OutTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning); InTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning); OutTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning); } catch (Exception e) { } System.out.printf("%-16s %-32s %14d %14d %14d %14d\n", // clusterName, // brokerName, // InTotalYest, // OutTotalYest, // InTotalToday, // OutTotalToday// ); } } } if (itCluster.hasNext()) { System.out.println(""); } } }
Example #26
Source File: ClusterListSubCommand.java From reading-and-annotate-rocketmq-3.4.6 with GNU General Public License v3.0 | 4 votes |
private void printClusterMoreStats(final DefaultMQAdminExt defaultMQAdminExt) throws RemotingConnectException, RemotingTimeoutException, RemotingSendRequestException, InterruptedException, MQBrokerException { ClusterInfo clusterInfoSerializeWrapper = defaultMQAdminExt.examineBrokerClusterInfo(); System.out.printf("%-16s %-32s %14s %14s %14s %14s\n",// "#Cluster Name",// "#Broker Name",// "#InTotalYest",// "#OutTotalYest",// "#InTotalToday",// "#OutTotalToday"// ); Iterator<Map.Entry<String, Set<String>>> itCluster = clusterInfoSerializeWrapper.getClusterAddrTable().entrySet().iterator(); while (itCluster.hasNext()) { Map.Entry<String, Set<String>> next = itCluster.next(); String clusterName = next.getKey(); TreeSet<String> brokerNameSet = new TreeSet<String>(); brokerNameSet.addAll(next.getValue()); for (String brokerName : brokerNameSet) { BrokerData brokerData = clusterInfoSerializeWrapper.getBrokerAddrTable().get(brokerName); if (brokerData != null) { Iterator<Map.Entry<Long, String>> itAddr = brokerData.getBrokerAddrs().entrySet().iterator(); while (itAddr.hasNext()) { Map.Entry<Long, String> next1 = itAddr.next(); long InTotalYest = 0; long OutTotalYest = 0; long InTotalToday = 0; long OutTotalToday = 0; try { KVTable kvTable = defaultMQAdminExt.fetchBrokerRuntimeStats(next1.getValue()); String msgPutTotalYesterdayMorning = kvTable.getTable().get("msgPutTotalYesterdayMorning"); String msgPutTotalTodayMorning = kvTable.getTable().get("msgPutTotalTodayMorning"); String msgPutTotalTodayNow = kvTable.getTable().get("msgPutTotalTodayNow"); String msgGetTotalYesterdayMorning = kvTable.getTable().get("msgGetTotalYesterdayMorning"); String msgGetTotalTodayMorning = kvTable.getTable().get("msgGetTotalTodayMorning"); String msgGetTotalTodayNow = kvTable.getTable().get("msgGetTotalTodayNow"); InTotalYest = Long.parseLong(msgPutTotalTodayMorning) - Long.parseLong(msgPutTotalYesterdayMorning); OutTotalYest = Long.parseLong(msgGetTotalTodayMorning) - Long.parseLong(msgGetTotalYesterdayMorning); InTotalToday = Long.parseLong(msgPutTotalTodayNow) - Long.parseLong(msgPutTotalTodayMorning); OutTotalToday = Long.parseLong(msgGetTotalTodayNow) - Long.parseLong(msgGetTotalTodayMorning); } catch (Exception e) { } System.out.printf("%-16s %-32s %14d %14d %14d %14d\n",// clusterName,// brokerName,// InTotalYest,// OutTotalYest,// InTotalToday,// OutTotalToday// ); } } } if (itCluster.hasNext()) { System.out.println(""); } } }