You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/10/25 06:22:20 UTC

[GitHub] [rocketmq] xiangwangcheng commented on a change in pull request #1433: [ISSUE #1432]fix ConcurrentModificationException when queryClusterInfo

xiangwangcheng commented on a change in pull request #1433: [ISSUE #1432]fix ConcurrentModificationException when queryClusterInfo
URL: https://github.com/apache/rocketmq/pull/1433#discussion_r338899235
 
 

 ##########
 File path: namesrv/src/main/java/org/apache/rocketmq/namesrv/routeinfo/RouteInfoManager.java
 ##########
 @@ -63,11 +63,21 @@ public RouteInfoManager() {
         this.filterServerTable = new HashMap<String, List<String>>(256);
     }
 
-    public byte[] getAllClusterInfo() {
-        ClusterInfo clusterInfoSerializeWrapper = new ClusterInfo();
-        clusterInfoSerializeWrapper.setBrokerAddrTable(this.brokerAddrTable);
-        clusterInfoSerializeWrapper.setClusterAddrTable(this.clusterAddrTable);
-        return clusterInfoSerializeWrapper.encode();
+    public byte[] getAllClusterInfo() throws InterruptedException {
+        try {
+            try {
+                this.lock.writeLock().lockInterruptibly();
 
 Review comment:
   I think readLock should be used here since it's a "get" request.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services