patsonluk commented on code in PR #909: URL: https://github.com/apache/solr/pull/909#discussion_r915236042
########## solr/solrj/src/java/org/apache/solr/common/cloud/ZkStateReader.java: ########## @@ -246,6 +244,90 @@ public boolean canBeRemoved() { } } + /** + * A ConcurrentHashMap of active watcher by collection name + * + * <p>Each watcher DocCollectionWatch also contains the latest DocCollection (state) observed + */ + private static class DocCollectionWatches + extends ConcurrentHashMap<String, DocCollectionWatch<DocCollectionWatcher>> { Review Comment: Thank you for the detailed explanations! @HoustonPutman 😊 I have refactored the code but somehow after the refactoring the test case `ZkStateReaderTest#testWatchRaceCondition` started to fail consistently almost every time , while I also ran it on the pre-refactor code around 10 times and it didn't fail once. I am still trying to figure out why, but meanwhile this is my change, perhaps something caught ur 👀 : https://github.com/fullstorydev/solr/compare/patsonluk/SOLR-16257/race-condition-can-lead-to-inconsistent-state...fullstorydev:solr:patsonluk/SOLR-16257/refactored?expand=1 -- 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: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org