dsmiley commented on code in PR #2611:
URL: https://github.com/apache/solr/pull/2611#discussion_r1704685321
##########
solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/CollectionPropertiesZkStateReader.java:
##########
@@ -300,10 +313,11 @@ private VersionedCollectionProps
fetchCollectionProperties(String collection, Wa
throws KeeperException, InterruptedException {
final String znodePath = getCollectionPropsPath(collection);
// lazy init cache cleaner once we know someone is using collection
properties.
- if (collectionPropsCacheCleaner == null) {
- synchronized (zkStateReader.getUpdateLock()) { // Double-checked locking
- if (collectionPropsCacheCleaner == null) {
- collectionPropsCacheCleaner = notifications.submit(new
CacheCleaner());
+ if (cacheCleanerThread == null) {
+ synchronized (this) {
+ if (cacheCleanerThread == null) {
Review Comment:
Probably should check for `!closed` as well so that we don't start this
thread after closing.
Come to think of it, the CacheCleaner ends on interruption and it doesn't
looked at "closed" at all. That's rather brittle; it should loop while
`!closed` and not "break" if Interrupted -- this is the typical approach.
Come to think of it further... hey, that CacheCleaner looks like a
"scheduled" job every minute. Could use a ScheduledExecutor and look more
"obvious". That's what I recommend. I know that changes things here :-)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]