ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ReentrantReadWriteLockTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ReentrantReadWriteLockTest.java (file contents):
Revision 1.53 by jsr166, Mon May 2 00:49:26 2011 UTC vs.
Revision 1.54 by jsr166, Mon May 2 01:07:15 2011 UTC

# Line 59 | Line 59 | public class ReentrantReadWriteLockTest
59      }
60  
61      /**
62 <     * Releases lock, checking that it had a hold count of 1.
62 >     * Releases write lock, checking that it had a hold count of 1.
63       */
64 <    void releaseLock(ReentrantReadWriteLock.WriteLock lock) {
65 <        assertTrue(lock.isHeldByCurrentThread());
66 <        lock.unlock();
67 <        assertFalse(lock.isHeldByCurrentThread());
64 >    void releaseWriteLock(ReentrantReadWriteLock lock) {
65 >        ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock();
66 >        assertTrue(writeLock.isHeldByCurrentThread());
67 >        writeLock.unlock();
68 >        assertFalse(writeLock.isHeldByCurrentThread());
69      }
70  
71      /**
# Line 208 | Line 209 | public class ReentrantReadWriteLockTest
209          Thread.sleep(SHORT_DELAY_MS);
210          t.interrupt();
211          awaitTermination(t, LONG_DELAY_MS);
212 <        releaseLock(lock.writeLock());
212 >        releaseWriteLock(lock);
213      }
214  
215      /**
# Line 225 | Line 226 | public class ReentrantReadWriteLockTest
226          Thread.sleep(SHORT_DELAY_MS);
227          t.interrupt();
228          awaitTermination(t, LONG_DELAY_MS);
229 <        releaseLock(lock.writeLock());
229 >        releaseWriteLock(lock);
230      }
231  
232      /**
# Line 242 | Line 243 | public class ReentrantReadWriteLockTest
243          Thread.sleep(SHORT_DELAY_MS);
244          t.interrupt();
245          awaitTermination(t, LONG_DELAY_MS);
246 <        releaseLock(lock.writeLock());
246 >        releaseWriteLock(lock);
247      }
248  
249      /**
# Line 259 | Line 260 | public class ReentrantReadWriteLockTest
260          Thread.sleep(SHORT_DELAY_MS);
261          t.interrupt();
262          awaitTermination(t, LONG_DELAY_MS);
263 <        releaseLock(lock.writeLock());
263 >        releaseWriteLock(lock);
264      }
265  
266  
# Line 275 | Line 276 | public class ReentrantReadWriteLockTest
276              }});
277  
278          awaitTermination(t, LONG_DELAY_MS);
279 <        lock.writeLock().unlock();
279 >        releaseWriteLock(lock);
280      }
281  
282      /**
# Line 290 | Line 291 | public class ReentrantReadWriteLockTest
291              }});
292  
293          awaitTermination(t, LONG_DELAY_MS);
294 <        lock.writeLock().unlock();
294 >        releaseWriteLock(lock);
295      }
296  
297      /**
# Line 350 | Line 351 | public class ReentrantReadWriteLockTest
351              }});
352  
353          Thread.sleep(SHORT_DELAY_MS);
354 <        lock.writeLock().unlock();
354 >        releaseWriteLock(lock);
355          awaitTermination(t1, LONG_DELAY_MS);
356          awaitTermination(t2, LONG_DELAY_MS);
357      }
# Line 667 | Line 668 | public class ReentrantReadWriteLockTest
668          Thread.sleep(SHORT_DELAY_MS);
669          t.interrupt();
670          awaitTermination(t, LONG_DELAY_MS);
671 <        releaseLock(lock.writeLock());
671 >        releaseWriteLock(lock);
672      }
673  
674      /**
# Line 684 | Line 685 | public class ReentrantReadWriteLockTest
685          Thread.sleep(SHORT_DELAY_MS);
686          t.interrupt();
687          awaitTermination(t, LONG_DELAY_MS);
688 <        releaseLock(lock.writeLock());
688 >        releaseWriteLock(lock);
689      }
690  
691      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines