mpetris commented on code in PR #1155:
URL: https://github.com/apache/solr/pull/1155#discussion_r1044515521


##########
solr/core/src/java/org/apache/solr/core/SolrCores.java:
##########
@@ -555,23 +658,41 @@ public boolean isCoreLoading(String name) {
   }
 
   public void queueCoreToClose(SolrCore coreToClose) {
-    synchronized (modifyLock) {
+    READ_WRITE_LOCK.writeLock().lock();
+    try {
       pendingCloses.add(coreToClose); // Essentially just queue this core up 
for closing.
-      modifyLock.notifyAll(); // Wakes up closer thread too
+      WRITE_LOCK_CONDITION.signalAll(); // Wakes up closer thread too
+    } finally {
+      READ_WRITE_LOCK.writeLock().unlock();
     }
   }
 
   /**
    * @return the cache holding the transient cores; never null.
    */
   public TransientSolrCoreCache getTransientCacheHandler() {
-    synchronized (modifyLock) {
-      if (transientSolrCoreCacheFactory == null) {
-        throw new SolrException(
-            SolrException.ErrorCode.SERVER_ERROR,
-            getClass().getName() + " not loaded; call load() before using it");
-      }
-      return transientSolrCoreCacheFactory.getTransientSolrCoreCache();
+    READ_WRITE_LOCK.writeLock().lock();

Review Comment:
   Hi @bruno-roustant, that's right. A read lock is sufficient here because we 
bypassed the lazy initialization of the `transientSolrCoreCache` by calling 
`getInternalTransientCacheHandler`right after the creation of the 
`transientSolrCoreCacheFactory` in `SolrCores::load`. We will change that and 
document accordingly.



-- 
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]

Reply via email to