From 4ad098103dce0d129f2019cb349e90c0fbca84ee Mon Sep 17 00:00:00 2001 From: erik Date: Sun, 15 Feb 2009 16:10:15 +0000 Subject: [PATCH 1/1] found an error in the junit test after a long time --- .../org/wamblee/concurrency/ReadWriteLockTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java b/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java index 2c159e94..40302f76 100644 --- a/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java +++ b/support/general/src/test/java/org/wamblee/concurrency/ReadWriteLockTest.java @@ -220,13 +220,15 @@ public class ReadWriteLockTest extends TestCase { WriteLocker writeLocker = new WriteLocker(_lock, this, TWO_SECONDS); Thread t3 = new Thread(writeLocker); - t1.start(); // acquire read lock + t1.start(); // acquire read lock [0, 2.5] Thread.sleep(ONE_SECOND); + // t = 1 assertTrue(getReaderCount() == 1); - t2.start(); + t2.start(); // acquire read lock [1, 3.5] Thread.sleep(HALF_SECOND); + // t = 1.5 assertTrue(getReaderCount() == 2); - t3.start(); + t3.start(); // write lock Thread.sleep(HALF_SECOND); // 2 seconds, @@ -238,7 +240,7 @@ public class ReadWriteLockTest extends TestCase { // have been released. assertTrue(getReaderCount() == 1); assertTrue(getWriterCount() == 0); - Thread.sleep(HALF_SECOND); + Thread.sleep(ONE_SECOND); // 4 seconds underway, write lock must have // been acquired. -- 2.31.1