Jason918 commented on a change in pull request #12654:
URL: https://github.com/apache/pulsar/pull/12654#discussion_r744563746
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
##########
@@ -474,7 +475,13 @@ public void registerListener(TopicName topicName,
TopicPolicyListener<TopicPolic
@Override
public void unregisterListener(TopicName topicName,
TopicPolicyListener<TopicPolicies> listener) {
- listeners.computeIfAbsent(topicName, k ->
Lists.newCopyOnWriteArrayList()).remove(listener);
Review comment:
> After that, thread A continues to remove the listener,
Not actually, because I am using an EMPTY map in listeners.remove(key,
EMPTY). The key will be removed if and only if no new listener is added to the
list in the meanwhile.
This code is a little tricky.
--
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]