francisoliverlee commented on code in PR #4395:
URL: https://github.com/apache/rocketmq/pull/4395#discussion_r887451393


##########
broker/src/main/java/org/apache/rocketmq/broker/client/ProducerManager.java:
##########
@@ -46,6 +50,32 @@ public ConcurrentHashMap<String, ConcurrentHashMap<Channel, 
ClientChannelInfo>>
         return groupChannelTable;
     }
 
+    public ProducerTableInfo getProducerTable(){
+        Map<String, List<ProducerInfo>> map = new HashMap<>();
+        for(String group: this.groupChannelTable.keySet()){
+            for(Entry<Channel, ClientChannelInfo> entry: 
this.groupChannelTable.get(group).entrySet()){
+                if(map.containsKey(group)){
+                    map.get(group).add(new ProducerInfo(
+                            entry.getValue().getClientId(),
+                            
entry.getValue().getChannel().remoteAddress().toString(),
+                            entry.getValue().getLanguage(),
+                            entry.getValue().getVersion(),
+                            entry.getValue().getLastUpdateTimestamp()
+                    ));
+                }else{
+                    map.put(group, new 
ArrayList<ProducerInfo>(Collections.singleton(new ProducerInfo(
+                            entry.getValue().getClientId(),
+                            
entry.getValue().getChannel().remoteAddress().toString(),
+                            entry.getValue().getLanguage(),
+                            entry.getValue().getVersion(),
+                            entry.getValue().getLastUpdateTimestamp()

Review Comment:
   > It may be better to defining a variable for `entry.getValue()` and reuse 
it.
   
   updated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to