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.32 by jsr166, Mon Nov 30 08:31:09 2009 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  
# Line 265 | Line 266 | public class ReentrantLockTest extends J
266          lock.lock();
267          Thread t = new Thread(new CheckedInterruptedRunnable() {
268              public void realRun() throws InterruptedException {
269 <                lock.tryLock(MEDIUM_DELAY_MS,TimeUnit.MILLISECONDS);
269 >                lock.tryLock(MEDIUM_DELAY_MS,MILLISECONDS);
270              }});
271  
272          t.start();
273 +        Thread.sleep(SHORT_DELAY_MS);
274          t.interrupt();
275          t.join();
276      }
# Line 298 | Line 300 | public class ReentrantLockTest extends J
300          lock.lock();
301          Thread t = new Thread(new CheckedRunnable() {
302              public void realRun() throws InterruptedException {
303 <                threadAssertFalse(lock.tryLock(1, TimeUnit.MILLISECONDS));
303 >                threadAssertFalse(lock.tryLock(1, MILLISECONDS));
304              }});
305  
306          t.start();
# Line 369 | Line 371 | public class ReentrantLockTest extends J
371          lock.lockInterruptibly();
372          Thread t = new Thread(new InterruptedLockRunnable(lock));
373          t.start();
374 +        Thread.sleep(SHORT_DELAY_MS);
375          t.interrupt();
376          assertTrue(lock.isLocked());
377          assertTrue(lock.isHeldByCurrentThread());
# Line 418 | Line 421 | public class ReentrantLockTest extends J
421          final ReentrantLock lock = new ReentrantLock();
422          final Condition c = lock.newCondition();
423          lock.lock();
424 <        assertFalse(c.await(SHORT_DELAY_MS, TimeUnit.MILLISECONDS));
424 >        assertFalse(c.await(SHORT_DELAY_MS, MILLISECONDS));
425          lock.unlock();
426      }
427  
# Line 773 | Line 776 | public class ReentrantLockTest extends J
776          Thread t = new Thread(new CheckedInterruptedRunnable() {
777              public void realRun() throws InterruptedException {
778                  lock.lock();
779 <                c.awaitNanos(1000 * 1000 * 1000); // 1 sec
779 >                c.awaitNanos(LONG_DELAY_MS * 1000L * 1000L);
780              }});
781  
782          t.start();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines