--- jsr166/src/test/loops/ReadHoldingWriteLock.java 2005/05/09 19:33:30 1.2 +++ jsr166/src/test/loops/ReadHoldingWriteLock.java 2009/10/29 23:09:08 1.3 @@ -26,7 +26,7 @@ class ReadHoldingWriteLock { /** * Readlocks succeed after a writing thread unlocks */ - public void testReadAfterWriteLock() throws Exception { + public void testReadAfterWriteLock() throws Exception { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); Thread t1 = new Thread(new Runnable() { @@ -50,25 +50,25 @@ class ReadHoldingWriteLock { t2.join(MEDIUM_DELAY_MS); assertTrue(!t1.isAlive()); assertTrue(!t2.isAlive()); - - } + + } /** * Read trylock succeeds if write locked by current thread */ - public void testReadHoldingWriteLock()throws Exception { + public void testReadHoldingWriteLock()throws Exception { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); lock.writeLock().unlock(); - } + } /** * Read lock succeeds if write locked by current thread even if * other threads are waiting */ - public void testReadHoldingWriteLock2() throws Exception{ + public void testReadHoldingWriteLock2() throws Exception{ final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); lock.writeLock().lock(); Thread t1 = new Thread(new Runnable() { @@ -83,7 +83,7 @@ class ReadHoldingWriteLock { lock.readLock().unlock(); } }); - + t1.start(); t2.start(); lock.readLock().lock(); @@ -96,24 +96,24 @@ class ReadHoldingWriteLock { t2.join(MEDIUM_DELAY_MS); assertTrue(!t1.isAlive()); assertTrue(!t2.isAlive()); - } + } /** * Fair Read trylock succeeds if write locked by current thread */ - public void testReadHoldingWriteLockFair() throws Exception{ + public void testReadHoldingWriteLockFair() throws Exception{ final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.writeLock().lock(); assertTrue(lock.readLock().tryLock()); lock.readLock().unlock(); lock.writeLock().unlock(); - } + } /** * Fair Read lock succeeds if write locked by current thread even if * other threads are waiting */ - public void testReadHoldingWriteLockFair2() throws Exception { + public void testReadHoldingWriteLockFair2() throws Exception { final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); lock.writeLock().lock(); Thread t1 = new Thread(new Runnable() { @@ -141,7 +141,7 @@ class ReadHoldingWriteLock { t2.join(MEDIUM_DELAY_MS); assertTrue(!t1.isAlive()); assertTrue(!t2.isAlive()); - - } + + } }