AnonHxy commented on PR #15139:
URL: https://github.com/apache/pulsar/pull/15139#issuecomment-1098221083

   > In order to avoid the same problem, do we need to improve 
`ConcurrentOpenHashMap`?
   > 
   > In `ConcurrentHashMap`, The same operation throws an exception, which 
makes it easier to spot the problem.
   > 
   > For example below:
   > 
   > ```
   > Map<String, String> map = new ConcurrentHashMap<>();
   > 
   > map.computeIfAbsent("test", (key) -> {
   >     map.remove("test");
   >     return "ok";
   > });
   > ```
   > 
   > It will throw `java.lang.IllegalStateException: Recursive update`
   
   That's great. But it will introduce a new problem.  For example the 
following code: 
   ```
    persistentTopic.stopReplProducers().whenComplete((v, exception) -> {
                                                   topics.remove(topic, 
topicFuture);
                                                   
topicFuture.completeExceptionally(ex);
                                               })
   ```
   If `topics.remove` throw exceptions, the topicFuture will not be done.  So 
we need check the existed code like this and also avoid in the future.  So in 
my opinion, we'd better keep it the way it is.@shibd 
   


-- 
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