You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/05 09:12:44 UTC

[GitHub] [pulsar] poorbarcode commented on a diff in pull request #16953: [fix][broker]Fix ConcurrentModificationException when ModularLoadManagerImpl start

poorbarcode commented on code in PR #16953:
URL: https://github.com/apache/pulsar/pull/16953#discussion_r938617143


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java:
##########
@@ -197,7 +197,7 @@ public class ModularLoadManagerImpl implements ModularLoadManager {
     private long unloadBundleCount = 0;
 
     private final Lock lock = new ReentrantLock();
-    private Set<String> knownBrokers = new HashSet<>();
+    private Set<String> knownBrokers = ConcurrentHashMap.newKeySet();

Review Comment:
   Maybe we can move this line below to method `start` and add some code comments, this could solves the concurrency problem. 
   
   
   https://github.com/apache/pulsar/blob/7650612cd86ead01886300f9b31aba6946831736/pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/impl/ModularLoadManagerImpl.java#L249



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org