Skip to content

Commit

Permalink
synchronizer attempts to trigger different threads within timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibor Digana committed Sep 23, 2012
1 parent 7602636 commit f71a2d4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
import org.junit.Before;
import org.junit.BeforeClass;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

public class ParallelMethodTest {
private static final long TIMEOUT= 15;
private static volatile Thread fOne= null;
private static volatile Thread fTwo= null;

Expand All @@ -25,12 +27,12 @@ public static class Example {
}
@Test public void one() throws InterruptedException {
fSynchronizer.countDown();
fSynchronizer.await();
assertTrue(fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
fOne= Thread.currentThread();
}
@Test public void two() throws InterruptedException {
fSynchronizer.countDown();
fSynchronizer.await();
assertTrue(fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
fTwo= Thread.currentThread();
}
}
Expand Down

0 comments on commit f71a2d4

Please sign in to comment.