lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1213023 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/src/test/org/apache/lucene/search/ lucene/src/java/org/apache/lucene/search/ lucene/src/test/org/apache/lucene/search/
Date Sun, 11 Dec 2011 17:17:45 GMT
Author: rmuir
Date: Sun Dec 11 17:17:44 2011
New Revision: 1213023

URL: http://svn.apache.org/viewvc?rev=1213023&view=rev
Log:
LUCENE-3636: make it possible to use SearcherManager with distributed stats

Added:
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherFactory.java
      - copied, changed from r1213020, lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/SearcherFactory.java
Removed:
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/org/apache/lucene/search/TestNRTManager.java
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/org/apache/lucene/search/TestSearcherManager.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherWarmer.java
Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/CHANGES.txt
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NRTManager.java
    lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherManager.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestNRTManager.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java

Modified: lucene/dev/branches/branch_3x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/CHANGES.txt?rev=1213023&r1=1213022&r2=1213023&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_3x/lucene/CHANGES.txt Sun Dec 11 17:17:44 2011
@@ -17,6 +17,13 @@ Changes in backwards compatibility polic
   were made final. This is not expected to affect many apps, since these methods
   already delegate to abstract methods, which you had to already override 
   anyway. (Shai Erera)
+
+* LUCENE-3636: Added SearcherFactory, used by SearcherManager and NRTManager
+  to create new IndexSearchers. You can provide your own implementation to
+  warm new searchers, set an ExecutorService, set a custom Similarity, or
+  even return your own subclass of IndexSearcher. The SearcherWarmer and
+  ExecutorService parameters on these classes were removed, as they are
+  subsumed by SearcherFactory.  (Shai Erera, Mike McCandless, Robert Muir)
   
 Security fixes
 

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NRTManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NRTManager.java?rev=1213023&r1=1213022&r2=1213023&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NRTManager.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/NRTManager.java
Sun Dec 11 17:17:44 2011
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.Condition;
@@ -35,6 +34,7 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.search.IndexSearcher; // javadocs
+import org.apache.lucene.search.SearcherFactory;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.ThreadInterruptedException;
@@ -50,6 +50,8 @@ import org.apache.lucene.util.ThreadInte
  * #addWaitingListener} so your reopener is notified when a
  * caller is waiting for a specific generation searcher. </p>
  *
+ * @see SearcherFactory
+ * 
  * @lucene.experimental
  */
 
@@ -66,60 +68,30 @@ public class NRTManager implements Close
   /**
    * Create new NRTManager.
    * 
-   *  @param writer IndexWriter to open near-real-time
-   *         readers
-   *  @param warmer optional {@link SearcherWarmer}.  Pass
-   *         null if you don't require the searcher to warmed
-   *         before going live.  If this is non-null then a
-   *         merged segment warmer is installed on the
-   *         provided IndexWriter's config.
-   *
-   *  <p><b>NOTE</b>: the provided {@link SearcherWarmer} is
-   *  not invoked for the initial searcher; you should
-   *  warm it yourself if necessary.
+   * @param writer IndexWriter to open near-real-time
+   *        readers
+   * @param searcherFactory An optional {@link SearcherFactory}. Pass
+   *        <code>null</code> if you don't require the searcher to be warmed
+   *        before going live or other custom behavior.
    */
-  public NRTManager(IndexWriter writer, SearcherWarmer warmer) throws IOException {
-    this(writer, null, warmer, true);
-  }
-
-  /**
-   * Create new NRTManager.
-   * 
-   *  @param writer IndexWriter to open near-real-time
-   *         readers
-   *  @param es optional ExecutorService so different segments can
-   *         be searched concurrently (see {@link IndexSearcher#IndexSearcher(IndexReader,
ExecutorService)}.
-   *         Pass <code>null</code> to search segments sequentially.
-   *  @param warmer optional {@link SearcherWarmer}.  Pass
-   *         null if you don't require the searcher to warmed
-   *         before going live.  If this is non-null then a
-   *         merged segment warmer is installed on the
-   *         provided IndexWriter's config.
-   *
-   *  <p><b>NOTE</b>: the provided {@link SearcherWarmer} is
-   *  not invoked for the initial searcher; you should
-   *  warm it yourself if necessary.
-   */
-  public NRTManager(IndexWriter writer, ExecutorService es,
-      SearcherWarmer warmer) throws IOException {
-    this(writer, es, warmer, true);
+  public NRTManager(IndexWriter writer, SearcherFactory searcherFactory) throws IOException
{
+    this(writer, searcherFactory, true);
   }
 
   /**
    * Expert: just like {@link
-   * #NRTManager(IndexWriter,ExecutorService,SearcherWarmer)},
+   * #NRTManager(IndexWriter,SearcherFactory)},
    * but you can also specify whether every searcher must
    * apply deletes.  This is useful for cases where certain
    * uses can tolerate seeing some deleted docs, since
    * reopen time is faster if deletes need not be applied. */
-  public NRTManager(IndexWriter writer, ExecutorService es,
-      SearcherWarmer warmer, boolean alwaysApplyDeletes) throws IOException {
+  public NRTManager(IndexWriter writer, SearcherFactory searcherFactory, boolean alwaysApplyDeletes)
throws IOException {
     this.writer = writer;
     if (alwaysApplyDeletes) {
-      withoutDeletes = withDeletes = new SearcherManagerRef(true, 0,  new SearcherManager(writer,
true, warmer, es));
+      withoutDeletes = withDeletes = new SearcherManagerRef(true, 0,  new SearcherManager(writer,
true, searcherFactory));
     } else {
-      withDeletes = new SearcherManagerRef(true, 0, new SearcherManager(writer, true, warmer,
es));
-      withoutDeletes = new SearcherManagerRef(false, 0, new SearcherManager(writer, false,
warmer, es));
+      withDeletes = new SearcherManagerRef(true, 0, new SearcherManager(writer, true, searcherFactory));
+      withoutDeletes = new SearcherManagerRef(false, 0, new SearcherManager(writer, false,
searcherFactory));
     }
     indexingGen = new AtomicLong(1);
   }

Copied: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherFactory.java
(from r1213020, lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/SearcherFactory.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherFactory.java?p2=lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherFactory.java&p1=lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/SearcherFactory.java&r1=1213020&r2=1213023&rev=1213023&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/search/SearcherFactory.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherFactory.java
Sun Dec 11 17:17:44 2011
@@ -23,7 +23,7 @@ import java.util.concurrent.ExecutorServ
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter; // javadocs
 import org.apache.lucene.index.IndexWriterConfig; // javadocs
-import org.apache.lucene.search.similarities.SimilarityProvider; // javadocs
+import org.apache.lucene.search.Similarity; // javadocs
 
 /**
  * Factory class used by {@link SearcherManager} and {@link NRTManager} to
@@ -38,7 +38,7 @@ import org.apache.lucene.search.similari
  * 
  * You can pass your own factory instead if you want custom behavior, such as:
  * <ul>
- *   <li>Setting a custom scoring model: {@link IndexSearcher#setSimilarityProvider(SimilarityProvider)}
+ *   <li>Setting a custom scoring model: {@link IndexSearcher#setSimilarity(Similarity)}
  *   <li>Parallel per-segment search: {@link IndexSearcher#IndexSearcher(IndexReader,
ExecutorService)}
  *   <li>Return custom subclasses of IndexSearcher (for example that implement distributed
scoring)
  *   <li>Run queries to warm your IndexSearcher before it is used. Note: when using
near-realtime search

Modified: lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherManager.java?rev=1213023&r1=1213022&r2=1213023&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherManager.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/SearcherManager.java
Sun Dec 11 17:17:44 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.search;
  */
 
 import java.io.IOException;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Semaphore;
 
 import org.apache.lucene.index.CorruptIndexException;
@@ -61,14 +60,15 @@ import org.apache.lucene.store.Directory
  * {@link NRTManager} since that class pulls near-real-time readers from the
  * IndexWriter.
  * 
+ * @see SearcherFactory
+ * 
  * @lucene.experimental
  */
 
 public final class SearcherManager {
 
   private volatile IndexSearcher currentSearcher;
-  private final ExecutorService es;
-  private final SearcherWarmer warmer;
+  private final SearcherFactory searcherFactory;
   private final Semaphore reopenLock = new Semaphore(1);
   
   /**
@@ -81,60 +81,41 @@ public final class SearcherManager {
    *        Applying deletes can be costly, so if your app can tolerate deleted documents
    *        being returned you might gain some performance by passing <code>false</code>.
    *        See {@link IndexReader#openIfChanged(IndexReader, IndexWriter, boolean)}.
-   * @param warmer An optional {@link SearcherWarmer}. Pass
-   *        <code>null</code> if you don't require the searcher to warmed
-   *        before going live.  If this is  <code>non-null</code> then a
-   *        merged segment warmer is installed on the
-   *        provided IndexWriter's config.
-   * @param es An optional {@link ExecutorService} so different segments can
-   *        be searched concurrently (see {@link
-   *        IndexSearcher#IndexSearcher(IndexReader,ExecutorService)}.  Pass <code>null</code>
-   *        to search segments sequentially.
+   * @param searcherFactory An optional {@link SearcherFactory}. Pass
+   *        <code>null</code> if you don't require the searcher to be warmed
+   *        before going live or other custom behavior.
    *        
    * @throws IOException
    */
-  public SearcherManager(IndexWriter writer, boolean applyAllDeletes,
-      final SearcherWarmer warmer, final ExecutorService es) throws IOException {
-    this.es = es;
-    this.warmer = warmer;
-    currentSearcher = new IndexSearcher(IndexReader.open(writer, applyAllDeletes));
-    if (warmer != null) {
-      writer.getConfig().setMergedSegmentWarmer(
-          new IndexWriter.IndexReaderWarmer() {
-            @Override
-            public void warm(IndexReader reader) throws IOException {
-              warmer.warm(new IndexSearcher(reader, es));
-            }
-          });
+  public SearcherManager(IndexWriter writer, boolean applyAllDeletes, SearcherFactory searcherFactory)
throws IOException {
+    if (searcherFactory == null) {
+      searcherFactory = new SearcherFactory();
     }
+    this.searcherFactory = searcherFactory;
+    currentSearcher = searcherFactory.newSearcher(IndexReader.open(writer, applyAllDeletes));
   }
 
   /**
    * Creates and returns a new SearcherManager from the given {@link Directory}. 
    * @param dir the directory to open the IndexReader on.
-   * @param warmer An optional {@link SearcherWarmer}.  Pass
-   *        <code>null</code> if you don't require the searcher to warmed
-   *        before going live.  If this is  <code>non-null</code> then a
-   *        merged segment warmer is installed on the
-   *        provided IndexWriter's config.
-   * @param es And optional {@link ExecutorService} so different segments can
-   *        be searched concurrently (see {@link
-   *        IndexSearcher#IndexSearcher(IndexReader,ExecutorService)}.  Pass <code>null</code>
-   *        to search segments sequentially.
+   * @param searcherFactory An optional {@link SearcherFactory}. Pass
+   *        <code>null</code> if you don't require the searcher to be warmed
+   *        before going live or other custom behavior.
    *        
    * @throws IOException
    */
-  public SearcherManager(Directory dir, SearcherWarmer warmer,
-      ExecutorService es) throws IOException {
-    this.es = es;
-    this.warmer = warmer;
-    currentSearcher = new IndexSearcher(IndexReader.open(dir, true), es);
+  public SearcherManager(Directory dir, SearcherFactory searcherFactory) throws IOException
{
+    if (searcherFactory == null) {
+      searcherFactory = new SearcherFactory();
+    }
+    this.searcherFactory = searcherFactory;
+    currentSearcher = searcherFactory.newSearcher(IndexReader.open(dir));
   }
 
   /**
    * You must call this, periodically, to perform a reopen. This calls
    * {@link IndexReader#openIfChanged(IndexReader)} with the underlying reader, and if that
returns a
-   * new reader, it's warmed (if you provided a {@link SearcherWarmer} and then
+   * new reader, it's warmed (if you provided a {@link SearcherFactory} and then
    * swapped into production.
    * 
    * <p>
@@ -167,12 +148,9 @@ public final class SearcherManager {
           release(searcherToReopen);
         }
         if (newReader != null) {
-          final IndexSearcher newSearcher = new IndexSearcher(newReader, es);
+          final IndexSearcher newSearcher = searcherFactory.newSearcher(newReader);
           boolean success = false;
           try {
-            if (warmer != null) {
-              warmer.warm(newSearcher);
-            }
             swapSearcher(newSearcher);
             success = true;
           } finally {
@@ -260,5 +238,4 @@ public final class SearcherManager {
     currentSearcher = newSearcher;
     release(oldSearcher);
   }
- 
 }

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestNRTManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestNRTManager.java?rev=1213023&r1=1213022&r2=1213023&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestNRTManager.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestNRTManager.java
Sun Dec 11 17:17:44 2011
@@ -29,10 +29,12 @@ import org.apache.lucene.document.Docume
 import org.apache.lucene.document.Field.Index;
 import org.apache.lucene.document.Field.Store;
 import org.apache.lucene.index.CorruptIndexException;
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.IndexWriterConfig;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.ThreadedIndexingAndSearchingTestCase;
+import org.apache.lucene.search.SearcherFactory;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.LockObtainFailedException;
 import org.apache.lucene.store.NRTCachingDirectory;
@@ -187,7 +189,7 @@ public class TestNRTManager extends Thre
   private NRTManager nrt;
   private NRTManagerReopenThread nrtThread;
   @Override
-  protected void doAfterWriter(ExecutorService es) throws Exception {
+  protected void doAfterWriter(final ExecutorService es) throws Exception {
     final double minReopenSec = 0.01 + 0.05 * random.nextDouble();
     final double maxReopenSec = minReopenSec * (1.0 + 10 * random.nextDouble());
 
@@ -195,14 +197,16 @@ public class TestNRTManager extends Thre
       System.out.println("TEST: make NRTManager maxReopenSec=" + maxReopenSec + " minReopenSec="
+ minReopenSec);
     }
 
-    nrt = new NRTManager(writer, es,
-                         new SearcherWarmer() {
+    nrt = new NRTManager(writer,
+                         new SearcherFactory() {
                            // Not with Java 5: @Override
-                           public void warm(IndexSearcher s) throws IOException {
-                             TestNRTManager.this.warmCalled = true;
-                             s.search(new TermQuery(new Term("body", "united")), 10);
-                           }
-                         }, false);
+                          public IndexSearcher newSearcher(IndexReader r) throws IOException
{
+                            TestNRTManager.this.warmCalled = true;
+                            IndexSearcher s = new IndexSearcher(r, es);
+                            s.search(new TermQuery(new Term("body", "united")), 10);
+                            return s;
+                          }
+                        }, false);
                          
     nrtThread = new NRTManagerReopenThread(nrt, maxReopenSec, minReopenSec);
     nrtThread.setName("NRT Reopen Thread");
@@ -264,7 +268,7 @@ public class TestNRTManager extends Thre
     final CountDownLatch signal = new CountDownLatch(1);
 
     LatchedIndexWriter writer = new LatchedIndexWriter(d, conf, latch, signal);
-    final NRTManager manager = new NRTManager(writer, null, null, false);
+    final NRTManager manager = new NRTManager(writer, null, false);
     Document doc = new Document();
     doc.add(newField("test","test", Store.YES, Index.ANALYZED));
     long gen = manager.addDocument(doc);

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java?rev=1213023&r1=1213022&r2=1213023&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestSearcherManager.java
Sun Dec 11 17:17:44 2011
@@ -29,9 +29,11 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.index.ConcurrentMergeScheduler;
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.ThreadedIndexingAndSearchingTestCase;
+import org.apache.lucene.search.SearcherFactory;
 import org.apache.lucene.store.AlreadyClosedException;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.NamedThreadFactory;
@@ -63,23 +65,25 @@ public class TestSearcherManager extends
   private boolean isNRT;
 
   @Override
-  protected void doAfterWriter(ExecutorService es) throws Exception {
-    final SearcherWarmer warmer = new SearcherWarmer() {
-      public void warm(IndexSearcher s) throws IOException {
+  protected void doAfterWriter(final ExecutorService es) throws Exception {
+    final SearcherFactory factory = new SearcherFactory() {
+      public IndexSearcher newSearcher(IndexReader r) throws IOException {
+        IndexSearcher s = new IndexSearcher(r, es);
         TestSearcherManager.this.warmCalled = true;
         s.search(new TermQuery(new Term("body", "united")), 10);
+        return s;
       }
     };
     if (random.nextBoolean()) {
       // TODO: can we randomize the applyAllDeletes?  But
       // somehow for final searcher we must apply
       // deletes...
-      mgr = new SearcherManager(writer, true, warmer, es);
+      mgr = new SearcherManager(writer, true, factory);
       isNRT = true;
     } else {
       // SearcherManager needs to see empty commit:
       writer.commit();
-      mgr = new SearcherManager(dir, warmer, es);
+      mgr = new SearcherManager(dir, factory);
       isNRT = false;
     }
 
@@ -102,8 +106,10 @@ public class TestSearcherManager extends
             }
           }
         } catch (Throwable t) {
-          System.out.println("TEST: reopen thread hit exc");
-          t.printStackTrace(System.out);
+          if (VERBOSE) {
+            System.out.println("TEST: reopen thread hit exc");
+            t.printStackTrace(System.out);
+          }
           failed.set(true);
           throw new RuntimeException(t);
         }
@@ -187,19 +193,27 @@ public class TestSearcherManager extends
     writer.commit();
     final CountDownLatch awaitEnterWarm = new CountDownLatch(1);
     final CountDownLatch awaitClose = new CountDownLatch(1);
+    final AtomicBoolean triedReopen = new AtomicBoolean(false);
     final ExecutorService es = random.nextBoolean() ? null : Executors.newCachedThreadPool(new
NamedThreadFactory("testIntermediateClose"));
-    final SearcherWarmer warmer = new SearcherWarmer() {
-      public void warm(IndexSearcher s) throws IOException {
+    final SearcherFactory factory = new SearcherFactory() {
+      public IndexSearcher newSearcher(IndexReader r) throws IOException {
         try {
-          awaitEnterWarm.countDown();
-          awaitClose.await();
+          if (triedReopen.get()) {
+            awaitEnterWarm.countDown();
+            awaitClose.await();
+          }
         } catch (InterruptedException e) {
           //
         }
+        return new IndexSearcher(r, es);
       }
     };
-    final SearcherManager searcherManager = random.nextBoolean() ? new SearcherManager(dir,
-        warmer, es) : new SearcherManager(writer, random.nextBoolean(), warmer, es);
+    final SearcherManager searcherManager = random.nextBoolean() 
+        ? new SearcherManager(dir, factory) 
+        : new SearcherManager(writer, random.nextBoolean(), factory);
+    if (VERBOSE) {
+      System.out.println("sm created");
+    }
     IndexSearcher searcher = searcherManager.acquire();
     try {
       assertEquals(1, searcher.getIndexReader().numDocs());
@@ -209,20 +223,24 @@ public class TestSearcherManager extends
     writer.addDocument(new Document());
     writer.commit();
     final AtomicBoolean success = new AtomicBoolean(false);
-    final AtomicBoolean triedReopen = new AtomicBoolean(false);
     final Throwable[] exc = new Throwable[1];
     Thread thread = new Thread(new Runnable() {
       //@Override - not on java 5
       public void run() {
         try {
           triedReopen.set(true);
+          if (VERBOSE) {
+            System.out.println("NOW call maybeReopen");
+          }
           searcherManager.maybeReopen();
           success.set(true);
         } catch (AlreadyClosedException e) {
           // expected
         } catch (Throwable e) {
-          System.out.println("FAIL: unexpected exc");
-          e.printStackTrace(System.out);
+          if (VERBOSE) {
+            System.out.println("FAIL: unexpected exc");
+            e.printStackTrace(System.out);
+          }
           exc[0] = e;
           // use success as the barrier here to make sure we see the write
           success.set(false);
@@ -231,7 +249,13 @@ public class TestSearcherManager extends
       }
     });
     thread.start();
+    if (VERBOSE) {
+      System.out.println("THREAD started");
+    }
     awaitEnterWarm.await();
+    if (VERBOSE) {
+      System.out.println("NOW call close");
+    }
     searcherManager.close();
     awaitClose.countDown();
     thread.join();



Mime
View raw message