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

Comparing jsr166/src/test/tck/ReentrantLockTest.java (file contents):
Revision 1.30 by jsr166, Sat Nov 21 02:07:27 2009 UTC vs.
Revision 1.36 by jsr166, Wed Aug 25 00:07:03 2010 UTC

# Line 9 | Line 9
9   import junit.framework.*;
10   import java.util.concurrent.locks.*;
11   import java.util.concurrent.*;
12 + import static java.util.concurrent.TimeUnit.MILLISECONDS;
13   import java.util.*;
14   import java.io.*;
15  
16   public class ReentrantLockTest extends JSR166TestCase {
17      public static void main(String[] args) {
18 <        junit.textui.TestRunner.run (suite());
18 >        junit.textui.TestRunner.run(suite());
19      }
20      public static Test suite() {
21          return new TestSuite(ReentrantLockTest.class);
# Line 55 | Line 56 | public class ReentrantLockTest extends J
56          public Collection<Thread> getWaitingThreads(Condition c) {
57              return super.getWaitingThreads(c);
58          }
58
59
59      }
60  
61      /**
# Line 265 | Line 264 | public class ReentrantLockTest extends J
264          lock.lock();
265          Thread t = new Thread(new CheckedInterruptedRunnable() {
266              public void realRun() throws InterruptedException {
267 <                lock.tryLock(MEDIUM_DELAY_MS,TimeUnit.MILLISECONDS);
267 >                lock.tryLock(MEDIUM_DELAY_MS,MILLISECONDS);
268              }});
269  
270          t.start();
271 +        Thread.sleep(SHORT_DELAY_MS);
272          t.interrupt();
273          t.join();
274      }
# Line 298 | Line 298 | public class ReentrantLockTest extends J
298          lock.lock();
299          Thread t = new Thread(new CheckedRunnable() {
300              public void realRun() throws InterruptedException {
301 <                threadAssertFalse(lock.tryLock(1, TimeUnit.MILLISECONDS));
301 >                threadAssertFalse(lock.tryLock(1, MILLISECONDS));
302              }});
303  
304          t.start();
# Line 369 | Line 369 | public class ReentrantLockTest extends J
369          lock.lockInterruptibly();
370          Thread t = new Thread(new InterruptedLockRunnable(lock));
371          t.start();
372 +        Thread.sleep(SHORT_DELAY_MS);
373          t.interrupt();
374          assertTrue(lock.isLocked());
375          assertTrue(lock.isHeldByCurrentThread());
# Line 418 | Line 419 | public class ReentrantLockTest extends J
419          final ReentrantLock lock = new ReentrantLock();
420          final Condition c = lock.newCondition();
421          lock.lock();
422 <        assertFalse(c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
422 >        assertFalse(c.await(SHORT_DELAY_MS, MILLISECONDS));
423          lock.unlock();
424      }
425  
# Line 773 | Line 774 | public class ReentrantLockTest extends J
774          Thread t = new Thread(new CheckedInterruptedRunnable() {
775              public void realRun() throws InterruptedException {
776                  lock.lock();
777 <                c.awaitNanos(1000 * 1000 * 1000); // 1 sec
777 >                c.awaitNanos(MILLISECONDS.toNanos(LONG_DELAY_MS));
778              }});
779  
780          t.start();
# Line 886 | Line 887 | public class ReentrantLockTest extends J
887              new ObjectOutputStream(new BufferedOutputStream(bout));
888          out.writeObject(l);
889          out.close();
890 <        
890 >
891          ByteArrayInputStream bin =
892              new ByteArrayInputStream(bout.toByteArray());
893          ObjectInputStream in =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines