mattisonchao commented on a change in pull request #14503:
URL: https://github.com/apache/pulsar/pull/14503#discussion_r816892656
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/SystemTopicBasedTopicPoliciesService.java
##########
@@ -373,6 +361,18 @@ private void
initPolicesCache(SystemTopicClient.Reader<PulsarEvent> reader, Comp
});
}
+ private void cleanCacheAndCloseReader(NamespaceName namespace, boolean
cleanOwnedBundlesCount) {
Review comment:
@codelipenghui @Technoboy-
Threading issues will be caused by the point in time when reader failures
and new reader creations occur at the same time.
We create a new Reader using the "prepareInitPoliciesCache" method, which
uses the "ConcurrentHashMap" to ensure that the "policyCacheInitMap" is atomic.
Therefore, we can clean this atomic value last when cleaning to ensure that
cleanup and new creation are atomic.
I'm not sure if this is a thread safety issue as you think. Please let me
know if I understand wrong.
--
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]