bruno-roustant commented on code in PR #3185:
URL: https://github.com/apache/solr/pull/3185#discussion_r1956345110


##########
solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java:
##########
@@ -421,9 +422,21 @@ public final Directory get(String path, DirContext 
dirContext, String rawLockTyp
         cacheValue.refCnt++;
         log.debug("Reusing cached directory: {}", cacheValue);
       }
-
-      return directory;
     }
+    return filterDirectory(directory, dirContext);
+  }
+
+  /**
+   * Potentially filters or unwraps the cached {@link Directory} depending on 
the intended use
+   * defined by the {@link DirContext}.
+   */
+  protected Directory filterDirectory(Directory dir, DirContext dirContext) {

Review Comment:
   I created a new filterDirectory method for two reasons:
   - The key for cached directories does not include the DirContext.
   - This method can be overridden if a DirectoryFactory implementation needs 
to adapt the filtering logic.



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

Reply via email to