lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1423738 - in /lucene/dev/trunk/solr: CHANGES.txt core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
Date Wed, 19 Dec 2012 02:56:16 GMT
Author: markrmiller
Date: Wed Dec 19 02:56:15 2012
New Revision: 1423738

URL: http://svn.apache.org/viewvc?rev=1423738&view=rev
Log:
SOLR-4213: Directories that are not shutdown until DirectoryFactory#close do not have close
listeners called on them.

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1423738&r1=1423737&r2=1423738&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Wed Dec 19 02:56:15 2012
@@ -369,6 +369,9 @@ Bug Fixes
 * SOLR-4198: OverseerCollectionProcessor should implement ClosableThread.
   (Mark Miller)
 
+* SOLR-4213: Directories that are not shutdown until DirectoryFactory#close 
+  do not have close listeners called on them. (Mark Miller)
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java?rev=1423738&r1=1423737&r2=1423738&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/core/CachingDirectoryFactory.java
Wed Dec 19 02:56:15 2012
@@ -138,7 +138,7 @@ public abstract class CachingDirectoryFa
           
           assert val.refCnt == 0 : val.refCnt;
           log.info("Closing directory when closing factory:" + val.path);
-          val.directory.close();
+          closeDirectory(val);
         } catch (Throwable t) {
           SolrException.log(log, "Error closing directory", t);
         }
@@ -164,31 +164,34 @@ public abstract class CachingDirectoryFa
 
       if (cacheValue.refCnt == 0 && cacheValue.doneWithDir) {
         log.info("Closing directory:" + cacheValue.path);
-        List<CloseListener> listeners = closeListeners.remove(directory);
-        if (listeners != null) {
-          for (CloseListener listener : listeners) {
-            listener.preClose();
-          }
-        }
-        try {
-          log.info("Closing directory:" + cacheValue.path);
-          directory.close();
-        } catch (Throwable t) {
-          SolrException.log(log, "Error closing directory", t);
-        }
-
-        if (listeners != null) {
-          for (CloseListener listener : listeners) {
-            listener.postClose();
-          }
-          closeListeners.remove(directory);
-        }
+        closeDirectory(cacheValue);
         
         byDirectoryCache.remove(directory);
         byPathCache.remove(cacheValue.path);
       }
     }
   }
+
+  private void closeDirectory(CacheValue cacheValue) {
+    List<CloseListener> listeners = closeListeners.remove(cacheValue.directory);
+    if (listeners != null) {
+      for (CloseListener listener : listeners) {
+        listener.preClose();
+      }
+    }
+    try {
+      log.info("Closing directory:" + cacheValue.path);
+      cacheValue.directory.close();
+    } catch (Throwable t) {
+      SolrException.log(log, "Error closing directory", t);
+    }
+    
+    if (listeners != null) {
+      for (CloseListener listener : listeners) {
+        listener.postClose();
+      }
+    }
+  }
   
   @Override
   protected abstract Directory create(String path) throws IOException;



Mime
View raw message