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


##########
solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java:
##########
@@ -391,25 +393,22 @@ public boolean exists(String path) throws IOException {
   public final Directory get(String path, DirContext dirContext, String 
rawLockType)
       throws IOException {
     String fullPath = normalize(path);
+    Directory directory;
+    CacheValue cacheValue;
     synchronized (this) {
       if (closed) {
         throw new AlreadyClosedException("Already closed");
       }
 
-      final CacheValue cacheValue = byPathCache.get(fullPath);
-      Directory directory = null;
-      if (cacheValue != null) {
-        directory = cacheValue.directory;
-      }
-
-      if (directory == null) {
+      cacheValue = byPathCache.get(fullPath);
+      if (cacheValue == null) {
         directory = create(fullPath, createLockFactory(rawLockType), 
dirContext);

Review Comment:
   I prefer to leave that for another PR (I have another proposal to make 
CachingDirectoryFactory support a DelegatingDirectoryFactory).
   For the TODO, I'm unsure as I see some usage of the DirContext in 
HdfsDirectoryFactory which seems valid (creating either a BlockDirectory or a 
HdfsDirectory).



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