lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1177994 - /lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/search/SearcherManager.java
Date Sat, 01 Oct 2011 14:37:32 GMT
Author: mikemccand
Date: Sat Oct  1 14:37:32 2011
New Revision: 1177994

URL: http://svn.apache.org/viewvc?rev=1177994&view=rev
Log:
LUCENE-3476: small code cleanup (use one try/finally/success)

Modified:
    lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/search/SearcherManager.java

Modified: lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/search/SearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/search/SearcherManager.java?rev=1177994&r1=1177993&r2=1177994&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/search/SearcherManager.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/misc/src/java/org/apache/lucene/search/SearcherManager.java
Sat Oct  1 14:37:32 2011
@@ -25,7 +25,7 @@ import java.util.concurrent.Semaphore;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.NRTManager; // javadocs
-import org.apache.lucene.search.IndexSearcher; // javadocs
+import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.store.AlreadyClosedException;
 import org.apache.lucene.store.Directory;
 
@@ -142,19 +142,11 @@ public class SearcherManager implements 
         IndexReader newReader = currentSearcher.getIndexReader().reopen();
         if (newReader != currentSearcher.getIndexReader()) {
           IndexSearcher newSearcher = new IndexSearcher(newReader, es);
-          if (warmer != null) {
-            boolean success = false;
-            try {
-              warmer.warm(newSearcher);
-              success = true;
-            } finally {
-              if (!success) {
-                newReader.decRef();
-              }
-            }
-          }
           boolean success = false;
           try {
+            if (warmer != null) {
+              warmer.warm(newSearcher);
+            }
             swapSearcher(newSearcher);
             success = true;
           } finally {



Mime
View raw message