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.55 by jsr166, Mon May 2 01:15:26 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 >        assertTrue(t1.isAlive());
355 >        assertTrue(t2.isAlive());
356 >        releaseWriteLock(lock);
357          awaitTermination(t1, LONG_DELAY_MS);
358          awaitTermination(t2, LONG_DELAY_MS);
359      }
# Line 667 | Line 670 | public class ReentrantReadWriteLockTest
670          Thread.sleep(SHORT_DELAY_MS);
671          t.interrupt();
672          awaitTermination(t, LONG_DELAY_MS);
673 <        releaseLock(lock.writeLock());
673 >        releaseWriteLock(lock);
674      }
675  
676      /**
# Line 684 | Line 687 | public class ReentrantReadWriteLockTest
687          Thread.sleep(SHORT_DELAY_MS);
688          t.interrupt();
689          awaitTermination(t, LONG_DELAY_MS);
690 <        releaseLock(lock.writeLock());
690 >        releaseWriteLock(lock);
691      }
692  
693      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines