You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/10/04 18:22:06 UTC

svn commit: r1394136 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java

Author: mikemccand
Date: Thu Oct  4 16:22:05 2012
New Revision: 1394136

URL: http://svn.apache.org/viewvc?rev=1394136&view=rev
Log:
fix some timeouts in this test

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/lucene/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/   (props changed)
    lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java

Modified: lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java?rev=1394136&r1=1394135&r2=1394136&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestDocumentsWriterStallControl.java Thu Oct  4 16:22:05 2012
@@ -40,18 +40,18 @@ public class TestDocumentsWriterStallCon
     start(waitThreads);
     assertFalse(ctrl.hasBlocked());
     assertFalse(ctrl.anyStalledThreads());
-    join(waitThreads, 10);
+    join(waitThreads);
     
     // now stall threads and wake them up again
     ctrl.updateStalled(true);
     waitThreads = waitThreads(atLeast(1), ctrl);
     start(waitThreads);
-    awaitState(100, Thread.State.WAITING, waitThreads);
+    awaitState(Thread.State.WAITING, waitThreads);
     assertTrue(ctrl.hasBlocked());
     assertTrue(ctrl.anyStalledThreads());
     ctrl.updateStalled(false);
     assertFalse(ctrl.anyStalledThreads());
-    join(waitThreads, 500);
+    join(waitThreads);
   }
   
   public void testRandom() throws InterruptedException {
@@ -90,7 +90,7 @@ public class TestDocumentsWriterStallCon
       }
       
     }
-    join(stallThreads, 100);
+    join(stallThreads);
     
   }
   
@@ -306,10 +306,10 @@ public class TestDocumentsWriterStallCon
     Thread.sleep(1); // let them start
   }
   
-  public static void join(Thread[] toJoin, long timeout)
+  public static void join(Thread[] toJoin)
       throws InterruptedException {
     for (Thread thread : toJoin) {
-      thread.join(timeout);
+      thread.join();
     }
   }
   
@@ -325,11 +325,12 @@ public class TestDocumentsWriterStallCon
     }
     return array;
   }
-  
-  public static void awaitState(long timeout, Thread.State state,
+
+  /** Waits for all incoming threads to be in wait()
+   *  methods. */
+  public static void awaitState(Thread.State state,
       Thread... threads) throws InterruptedException {
-    long t = System.currentTimeMillis();
-    while (System.currentTimeMillis() - t <= timeout) {
+    while (true) {
       boolean done = true;
       for (Thread thread : threads) {
         if (thread.getState() != state) {
@@ -345,8 +346,6 @@ public class TestDocumentsWriterStallCon
         Thread.sleep(1);
       }
     }
-    fail("timed out waiting for state: " + state + " timeout: " + timeout
-        + " ms");
   }
   
   private static final class Synchronizer {