HoustonPutman commented on code in PR #909: URL: https://github.com/apache/solr/pull/909#discussion_r915038151
########## 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: So I think Mike just wants this new class to have a single variable, the CHM, and all methods act on it. Since the CHM is thread safe (well for the uses we are using it for currently), there should be no difference to calling the CHM methods, versus calling the new `DocCollectionWatches` methods that directly call the CHM. I agree that it's probably a more easy to reason-out method, since most people aren't expecting the built-in classes to be extended. More-so, it allows developers down the line to interact directly with the CHM, while you have already written careful methods to abstract out interacting with it. So basically all you need to do is abstract out a few more of these methods, and you have a guarantee that no one is going to do something sketchy to the CHM without going through the allowed paradigms. @madrob feel free to add more if you had other reasons. Overall the change should not have to affect a whole lot of the PR. You might just need to add the following methods: `getAllCollections()` `numCollections()` and `numActiveCollections()`, and use them instead of the CHM methods throughout the rest of the file. -- 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