lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1183754 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/backwards/src/test/ lucene/contrib/misc/src/test/org/apache/lucene/search/TestSearcherManager.java solr/
Date Sat, 15 Oct 2011 22:46:22 GMT
Author: mikemccand
Date: Sat Oct 15 22:46:22 2011
New Revision: 1183754

URL: http://svn.apache.org/viewvc?rev=1183754&view=rev
Log:
fix deadlock case in test

Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/backwards/src/test/   (props changed)
    lucene/dev/branches/branch_3x/lucene/contrib/misc/src/test/org/apache/lucene/search/TestSearcherManager.java
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/contrib/misc/src/test/org/apache/lucene/search/TestSearcherManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/misc/src/test/org/apache/lucene/search/TestSearcherManager.java?rev=1183754&r1=1183753&r2=1183754&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/misc/src/test/org/apache/lucene/search/TestSearcherManager.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/misc/src/test/org/apache/lucene/search/TestSearcherManager.java
Sat Oct 15 22:46:22 2011
@@ -18,16 +18,17 @@ package org.apache.lucene.search;
  */
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
-import java.util.List;
-import java.util.ArrayList;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.ConcurrentMergeScheduler;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.ThreadedIndexingAndSearchingTestCase;
@@ -63,7 +64,6 @@ public class TestSearcherManager extends
 
   @Override
   protected void doAfterWriter(ExecutorService es) throws Exception {
-    // SearcherManager needs to see empty commit:
     final SearcherWarmer warmer = new SearcherWarmer() {
       public void warm(IndexSearcher s) throws IOException {
         TestSearcherManager.this.warmCalled = true;
@@ -74,6 +74,7 @@ public class TestSearcherManager extends
       mgr = SearcherManager.open(writer, true, warmer, es);
       isNRT = true;
     } else {
+      // SearcherManager needs to see empty commit:
       writer.commit();
       mgr = SearcherManager.open(dir, warmer, es);
       isNRT = false;
@@ -176,8 +177,9 @@ public class TestSearcherManager extends
   
   public void testIntermediateClose() throws IOException, InterruptedException {
     Directory dir = newDirectory();
+    // Test can deadlock if we use SMS:
     IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(
-        TEST_VERSION_CURRENT, new MockAnalyzer(random)));
+                                                                   TEST_VERSION_CURRENT,
new MockAnalyzer(random)).setMergeScheduler(new ConcurrentMergeScheduler()));
     writer.addDocument(new Document());
     writer.commit();
     final CountDownLatch awaitEnterWarm = new CountDownLatch(1);



Mime
View raw message