68 |
|
* Read lock succeeds if write locked by current thread even if |
69 |
|
* other threads are waiting |
70 |
|
*/ |
71 |
< |
public void testReadHoldingWriteLock2() throws Exception{ |
71 |
> |
public void testReadHoldingWriteLock2() throws Exception { |
72 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); |
73 |
|
lock.writeLock().lock(); |
74 |
|
Thread t1 = new Thread(new Runnable() { |
101 |
|
/** |
102 |
|
* Fair Read trylock succeeds if write locked by current thread |
103 |
|
*/ |
104 |
< |
public void testReadHoldingWriteLockFair() throws Exception{ |
104 |
> |
public void testReadHoldingWriteLockFair() throws Exception { |
105 |
|
final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true); |
106 |
|
lock.writeLock().lock(); |
107 |
|
assertTrue(lock.readLock().tryLock()); |