65 |
|
} |
66 |
|
|
67 |
|
/** |
68 |
< |
* A runnable calling acquireInterruptibly |
68 |
> |
* A runnable calling acquireInterruptibly that does not expect to |
69 |
> |
* be interrupted. |
70 |
|
*/ |
71 |
< |
class InterruptibleSyncRunnable implements Runnable { |
71 |
> |
class InterruptibleSyncRunnable extends CheckedRunnable { |
72 |
|
final Mutex sync; |
73 |
|
InterruptibleSyncRunnable(Mutex l) { sync = l; } |
74 |
< |
public void run() { |
75 |
< |
try { |
75 |
< |
sync.acquireInterruptibly(1); |
76 |
< |
} catch (InterruptedException success) {} |
74 |
> |
public void realRun() throws InterruptedException { |
75 |
> |
sync.acquireInterruptibly(1); |
76 |
|
} |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
/** |
81 |
|
* A runnable calling acquireInterruptibly that expects to be |
82 |
< |
* interrupted |
82 |
> |
* interrupted. |
83 |
|
*/ |
84 |
< |
class InterruptedSyncRunnable implements Runnable { |
84 |
> |
class InterruptedSyncRunnable extends CheckedInterruptedRunnable { |
85 |
|
final Mutex sync; |
86 |
|
InterruptedSyncRunnable(Mutex l) { sync = l; } |
87 |
< |
public void run() { |
88 |
< |
try { |
90 |
< |
sync.acquireInterruptibly(1); |
91 |
< |
threadShouldThrow(); |
92 |
< |
} catch (InterruptedException success) {} |
87 |
> |
public void realRun() throws InterruptedException { |
88 |
> |
sync.acquireInterruptibly(1); |
89 |
|
} |
90 |
|
} |
91 |
|
|
321 |
|
/** |
322 |
|
* tryAcquireNanos is interruptible. |
323 |
|
*/ |
324 |
< |
public void testInterruptedException2() { |
324 |
> |
public void testInterruptedException2() throws InterruptedException { |
325 |
|
final Mutex sync = new Mutex(); |
326 |
|
sync.acquire(1); |
327 |
< |
Thread t = new Thread(new Runnable() { |
328 |
< |
public void run() { |
329 |
< |
try { |
330 |
< |
sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000); |
335 |
< |
threadShouldThrow(); |
336 |
< |
} catch (InterruptedException success) {} |
337 |
< |
} |
338 |
< |
}); |
327 |
> |
Thread t = new Thread(new CheckedInterruptedRunnable() { |
328 |
> |
public void realRun() throws InterruptedException { |
329 |
> |
sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000); |
330 |
> |
}}); |
331 |
|
|
332 |
|
t.start(); |
333 |
|
t.interrupt(); |
334 |
+ |
t.join(); |
335 |
|
} |
336 |
|
|
337 |
|
|
341 |
|
public void testTryAcquireWhenSynced() throws InterruptedException { |
342 |
|
final Mutex sync = new Mutex(); |
343 |
|
sync.acquire(1); |
344 |
< |
Thread t = new Thread(new Runnable() { |
345 |
< |
public void run() { |
346 |
< |
threadAssertFalse(sync.tryAcquire(1)); |
347 |
< |
} |
355 |
< |
}); |
344 |
> |
Thread t = new Thread(new CheckedRunnable() { |
345 |
> |
public void realRun() { |
346 |
> |
threadAssertFalse(sync.tryAcquire(1)); |
347 |
> |
}}); |
348 |
|
|
349 |
|
t.start(); |
350 |
|
t.join(); |
357 |
|
public void testAcquireNanos_Timeout() throws InterruptedException { |
358 |
|
final Mutex sync = new Mutex(); |
359 |
|
sync.acquire(1); |
360 |
< |
Thread t = new Thread(new Runnable() { |
361 |
< |
public void run() { |
362 |
< |
try { |
363 |
< |
threadAssertFalse(sync.tryAcquireNanos(1, 1000 * 1000)); |
372 |
< |
} catch (Exception ex) { |
373 |
< |
threadUnexpectedException(); |
374 |
< |
} |
375 |
< |
} |
376 |
< |
}); |
360 |
> |
Thread t = new Thread(new CheckedRunnable() { |
361 |
> |
public void realRun() throws InterruptedException { |
362 |
> |
threadAssertFalse(sync.tryAcquireNanos(1, 1000 * 1000)); |
363 |
> |
}}); |
364 |
|
|
365 |
|
t.start(); |
366 |
|
t.join(); |
377 |
|
assertTrue(sync.isHeldExclusively()); |
378 |
|
sync.release(1); |
379 |
|
assertFalse(sync.isHeldExclusively()); |
380 |
< |
Thread t = new Thread(new Runnable() { |
381 |
< |
public void run() { |
382 |
< |
sync.acquire(1); |
383 |
< |
try { |
384 |
< |
Thread.sleep(SMALL_DELAY_MS); |
385 |
< |
} |
399 |
< |
catch (Exception e) { |
400 |
< |
threadUnexpectedException(); |
401 |
< |
} |
402 |
< |
sync.release(1); |
403 |
< |
} |
404 |
< |
}); |
380 |
> |
Thread t = new Thread(new CheckedRunnable() { |
381 |
> |
public void realRun() throws InterruptedException { |
382 |
> |
sync.acquire(1); |
383 |
> |
Thread.sleep(SMALL_DELAY_MS); |
384 |
> |
sync.release(1); |
385 |
> |
}}); |
386 |
|
|
387 |
|
t.start(); |
388 |
|
Thread.sleep(SHORT_DELAY_MS); |
441 |
|
try { |
442 |
|
c.await(); |
443 |
|
shouldThrow(); |
444 |
< |
} |
464 |
< |
catch (IllegalMonitorStateException success) {} |
444 |
> |
} catch (IllegalMonitorStateException success) {} |
445 |
|
} |
446 |
|
|
447 |
|
/** |
453 |
|
try { |
454 |
|
c.signal(); |
455 |
|
shouldThrow(); |
456 |
< |
} |
477 |
< |
catch (IllegalMonitorStateException success) {} |
456 |
> |
} catch (IllegalMonitorStateException success) {} |
457 |
|
} |
458 |
|
|
459 |
|
/** |
497 |
|
public void testAwait() throws InterruptedException { |
498 |
|
final Mutex sync = new Mutex(); |
499 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
500 |
< |
Thread t = new Thread(new Runnable() { |
501 |
< |
public void run() { |
502 |
< |
try { |
503 |
< |
sync.acquire(1); |
504 |
< |
c.await(); |
505 |
< |
sync.release(1); |
527 |
< |
} |
528 |
< |
catch (InterruptedException e) { |
529 |
< |
threadUnexpectedException(); |
530 |
< |
} |
531 |
< |
} |
532 |
< |
}); |
500 |
> |
Thread t = new Thread(new CheckedRunnable() { |
501 |
> |
public void realRun() throws InterruptedException { |
502 |
> |
sync.acquire(1); |
503 |
> |
c.await(); |
504 |
> |
sync.release(1); |
505 |
> |
}}); |
506 |
|
|
507 |
|
t.start(); |
508 |
|
Thread.sleep(SHORT_DELAY_MS); |
635 |
|
public void testHasWaiters() throws InterruptedException { |
636 |
|
final Mutex sync = new Mutex(); |
637 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
638 |
< |
Thread t = new Thread(new Runnable() { |
639 |
< |
public void run() { |
640 |
< |
try { |
641 |
< |
sync.acquire(1); |
642 |
< |
threadAssertFalse(sync.hasWaiters(c)); |
643 |
< |
threadAssertEquals(0, sync.getWaitQueueLength(c)); |
644 |
< |
c.await(); |
645 |
< |
sync.release(1); |
673 |
< |
} |
674 |
< |
catch (InterruptedException e) { |
675 |
< |
threadUnexpectedException(); |
676 |
< |
} |
677 |
< |
} |
678 |
< |
}); |
638 |
> |
Thread t = new Thread(new CheckedRunnable() { |
639 |
> |
public void realRun() throws InterruptedException { |
640 |
> |
sync.acquire(1); |
641 |
> |
threadAssertFalse(sync.hasWaiters(c)); |
642 |
> |
threadAssertEquals(0, sync.getWaitQueueLength(c)); |
643 |
> |
c.await(); |
644 |
> |
sync.release(1); |
645 |
> |
}}); |
646 |
|
|
647 |
|
t.start(); |
648 |
|
Thread.sleep(SHORT_DELAY_MS); |
666 |
|
public void testGetWaitQueueLength() throws InterruptedException { |
667 |
|
final Mutex sync = new Mutex(); |
668 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
669 |
< |
Thread t1 = new Thread(new Runnable() { |
670 |
< |
public void run() { |
671 |
< |
try { |
672 |
< |
sync.acquire(1); |
673 |
< |
threadAssertFalse(sync.hasWaiters(c)); |
674 |
< |
threadAssertEquals(0, sync.getWaitQueueLength(c)); |
675 |
< |
c.await(); |
676 |
< |
sync.release(1); |
677 |
< |
} |
678 |
< |
catch (InterruptedException e) { |
679 |
< |
threadUnexpectedException(); |
680 |
< |
} |
681 |
< |
} |
682 |
< |
}); |
683 |
< |
|
684 |
< |
Thread t2 = new Thread(new Runnable() { |
685 |
< |
public void run() { |
719 |
< |
try { |
720 |
< |
sync.acquire(1); |
721 |
< |
threadAssertTrue(sync.hasWaiters(c)); |
722 |
< |
threadAssertEquals(1, sync.getWaitQueueLength(c)); |
723 |
< |
c.await(); |
724 |
< |
sync.release(1); |
725 |
< |
} |
726 |
< |
catch (InterruptedException e) { |
727 |
< |
threadUnexpectedException(); |
728 |
< |
} |
729 |
< |
} |
730 |
< |
}); |
669 |
> |
Thread t1 = new Thread(new CheckedRunnable() { |
670 |
> |
public void realRun() throws InterruptedException { |
671 |
> |
sync.acquire(1); |
672 |
> |
threadAssertFalse(sync.hasWaiters(c)); |
673 |
> |
threadAssertEquals(0, sync.getWaitQueueLength(c)); |
674 |
> |
c.await(); |
675 |
> |
sync.release(1); |
676 |
> |
}}); |
677 |
> |
|
678 |
> |
Thread t2 = new Thread(new CheckedRunnable() { |
679 |
> |
public void realRun() throws InterruptedException { |
680 |
> |
sync.acquire(1); |
681 |
> |
threadAssertTrue(sync.hasWaiters(c)); |
682 |
> |
threadAssertEquals(1, sync.getWaitQueueLength(c)); |
683 |
> |
c.await(); |
684 |
> |
sync.release(1); |
685 |
> |
}}); |
686 |
|
|
687 |
|
t1.start(); |
688 |
|
Thread.sleep(SHORT_DELAY_MS); |
710 |
|
public void testGetWaitingThreads() throws InterruptedException { |
711 |
|
final Mutex sync = new Mutex(); |
712 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
713 |
< |
Thread t1 = new Thread(new Runnable() { |
714 |
< |
public void run() { |
715 |
< |
try { |
716 |
< |
sync.acquire(1); |
717 |
< |
threadAssertTrue(sync.getWaitingThreads(c).isEmpty()); |
718 |
< |
c.await(); |
719 |
< |
sync.release(1); |
720 |
< |
} |
721 |
< |
catch (InterruptedException e) { |
722 |
< |
threadUnexpectedException(); |
723 |
< |
} |
724 |
< |
} |
725 |
< |
}); |
726 |
< |
|
727 |
< |
Thread t2 = new Thread(new Runnable() { |
773 |
< |
public void run() { |
774 |
< |
try { |
775 |
< |
sync.acquire(1); |
776 |
< |
threadAssertFalse(sync.getWaitingThreads(c).isEmpty()); |
777 |
< |
c.await(); |
778 |
< |
sync.release(1); |
779 |
< |
} |
780 |
< |
catch (InterruptedException e) { |
781 |
< |
threadUnexpectedException(); |
782 |
< |
} |
783 |
< |
} |
784 |
< |
}); |
713 |
> |
Thread t1 = new Thread(new CheckedRunnable() { |
714 |
> |
public void realRun() throws InterruptedException { |
715 |
> |
sync.acquire(1); |
716 |
> |
threadAssertTrue(sync.getWaitingThreads(c).isEmpty()); |
717 |
> |
c.await(); |
718 |
> |
sync.release(1); |
719 |
> |
}}); |
720 |
> |
|
721 |
> |
Thread t2 = new Thread(new CheckedRunnable() { |
722 |
> |
public void realRun() throws InterruptedException { |
723 |
> |
sync.acquire(1); |
724 |
> |
threadAssertFalse(sync.getWaitingThreads(c).isEmpty()); |
725 |
> |
c.await(); |
726 |
> |
sync.release(1); |
727 |
> |
}}); |
728 |
|
|
729 |
|
sync.acquire(1); |
730 |
|
assertTrue(sync.getWaitingThreads(c).isEmpty()); |
758 |
|
public void testAwaitUninterruptibly() throws InterruptedException { |
759 |
|
final Mutex sync = new Mutex(); |
760 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
761 |
< |
Thread t = new Thread(new Runnable() { |
762 |
< |
public void run() { |
763 |
< |
sync.acquire(1); |
764 |
< |
c.awaitUninterruptibly(); |
765 |
< |
sync.release(1); |
766 |
< |
} |
824 |
< |
}); |
761 |
> |
Thread t = new Thread(new CheckedRunnable() { |
762 |
> |
public void realRun() { |
763 |
> |
sync.acquire(1); |
764 |
> |
c.awaitUninterruptibly(); |
765 |
> |
sync.release(1); |
766 |
> |
}}); |
767 |
|
|
768 |
|
t.start(); |
769 |
|
Thread.sleep(SHORT_DELAY_MS); |
781 |
|
public void testAwait_Interrupt() throws InterruptedException { |
782 |
|
final Mutex sync = new Mutex(); |
783 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
784 |
< |
Thread t = new Thread(new Runnable() { |
785 |
< |
public void run() { |
786 |
< |
try { |
787 |
< |
sync.acquire(1); |
788 |
< |
c.await(); |
789 |
< |
sync.release(1); |
848 |
< |
threadShouldThrow(); |
849 |
< |
} |
850 |
< |
catch (InterruptedException success) { |
851 |
< |
} |
852 |
< |
} |
853 |
< |
}); |
784 |
> |
Thread t = new Thread(new CheckedInterruptedRunnable() { |
785 |
> |
public void realRun() throws InterruptedException { |
786 |
> |
sync.acquire(1); |
787 |
> |
c.await(); |
788 |
> |
sync.release(1); |
789 |
> |
}}); |
790 |
|
|
791 |
|
t.start(); |
792 |
|
Thread.sleep(SHORT_DELAY_MS); |
801 |
|
public void testAwaitNanos_Interrupt() throws InterruptedException { |
802 |
|
final Mutex sync = new Mutex(); |
803 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
804 |
< |
Thread t = new Thread(new Runnable() { |
805 |
< |
public void run() { |
806 |
< |
try { |
807 |
< |
sync.acquire(1); |
808 |
< |
c.awaitNanos(1000 * 1000 * 1000); // 1 sec |
809 |
< |
sync.release(1); |
874 |
< |
threadShouldThrow(); |
875 |
< |
} |
876 |
< |
catch (InterruptedException success) { |
877 |
< |
} |
878 |
< |
} |
879 |
< |
}); |
804 |
> |
Thread t = new Thread(new CheckedInterruptedRunnable() { |
805 |
> |
public void realRun() throws InterruptedException { |
806 |
> |
sync.acquire(1); |
807 |
> |
c.awaitNanos(1000 * 1000 * 1000); // 1 sec |
808 |
> |
sync.release(1); |
809 |
> |
}}); |
810 |
|
|
811 |
|
t.start(); |
812 |
|
Thread.sleep(SHORT_DELAY_MS); |
821 |
|
public void testAwaitUntil_Interrupt() throws InterruptedException { |
822 |
|
final Mutex sync = new Mutex(); |
823 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
824 |
< |
Thread t = new Thread(new Runnable() { |
825 |
< |
public void run() { |
826 |
< |
try { |
827 |
< |
sync.acquire(1); |
828 |
< |
java.util.Date d = new java.util.Date(); |
829 |
< |
c.awaitUntil(new java.util.Date(d.getTime() + 10000)); |
830 |
< |
sync.release(1); |
901 |
< |
threadShouldThrow(); |
902 |
< |
} |
903 |
< |
catch (InterruptedException success) { |
904 |
< |
} |
905 |
< |
} |
906 |
< |
}); |
824 |
> |
Thread t = new Thread(new CheckedInterruptedRunnable() { |
825 |
> |
public void realRun() throws InterruptedException { |
826 |
> |
sync.acquire(1); |
827 |
> |
java.util.Date d = new java.util.Date(); |
828 |
> |
c.awaitUntil(new java.util.Date(d.getTime() + 10000)); |
829 |
> |
sync.release(1); |
830 |
> |
}}); |
831 |
|
|
832 |
|
t.start(); |
833 |
|
Thread.sleep(SHORT_DELAY_MS); |
842 |
|
public void testSignalAll() throws InterruptedException { |
843 |
|
final Mutex sync = new Mutex(); |
844 |
|
final AbstractQueuedSynchronizer.ConditionObject c = sync.newCondition(); |
845 |
< |
Thread t1 = new Thread(new Runnable() { |
846 |
< |
public void run() { |
847 |
< |
try { |
848 |
< |
sync.acquire(1); |
849 |
< |
c.await(); |
850 |
< |
sync.release(1); |
851 |
< |
} |
852 |
< |
catch (InterruptedException e) { |
853 |
< |
threadUnexpectedException(); |
854 |
< |
} |
855 |
< |
} |
856 |
< |
}); |
857 |
< |
|
934 |
< |
Thread t2 = new Thread(new Runnable() { |
935 |
< |
public void run() { |
936 |
< |
try { |
937 |
< |
sync.acquire(1); |
938 |
< |
c.await(); |
939 |
< |
sync.release(1); |
940 |
< |
} |
941 |
< |
catch (InterruptedException e) { |
942 |
< |
threadUnexpectedException(); |
943 |
< |
} |
944 |
< |
} |
945 |
< |
}); |
845 |
> |
Thread t1 = new Thread(new CheckedRunnable() { |
846 |
> |
public void realRun() throws InterruptedException { |
847 |
> |
sync.acquire(1); |
848 |
> |
c.await(); |
849 |
> |
sync.release(1); |
850 |
> |
}}); |
851 |
> |
|
852 |
> |
Thread t2 = new Thread(new CheckedRunnable() { |
853 |
> |
public void realRun() throws InterruptedException { |
854 |
> |
sync.acquire(1); |
855 |
> |
c.await(); |
856 |
> |
sync.release(1); |
857 |
> |
}}); |
858 |
|
|
859 |
|
t1.start(); |
860 |
|
t2.start(); |
929 |
|
public void testAcquireSharedInterruptibly() throws InterruptedException { |
930 |
|
final BooleanLatch l = new BooleanLatch(); |
931 |
|
|
932 |
< |
Thread t = new Thread(new Runnable() { |
933 |
< |
public void run() { |
934 |
< |
try { |
935 |
< |
threadAssertFalse(l.isSignalled()); |
936 |
< |
l.acquireSharedInterruptibly(0); |
937 |
< |
threadAssertTrue(l.isSignalled()); |
1026 |
< |
} catch (InterruptedException e) { |
1027 |
< |
threadUnexpectedException(); |
1028 |
< |
} |
1029 |
< |
} |
1030 |
< |
}); |
932 |
> |
Thread t = new Thread(new CheckedRunnable() { |
933 |
> |
public void realRun() throws InterruptedException { |
934 |
> |
threadAssertFalse(l.isSignalled()); |
935 |
> |
l.acquireSharedInterruptibly(0); |
936 |
> |
threadAssertTrue(l.isSignalled()); |
937 |
> |
}}); |
938 |
|
|
939 |
|
t.start(); |
940 |
|
assertFalse(l.isSignalled()); |
951 |
|
public void testAsquireSharedTimed() throws InterruptedException { |
952 |
|
final BooleanLatch l = new BooleanLatch(); |
953 |
|
|
954 |
< |
Thread t = new Thread(new Runnable() { |
955 |
< |
public void run() { |
956 |
< |
try { |
957 |
< |
threadAssertFalse(l.isSignalled()); |
958 |
< |
threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000)); |
959 |
< |
threadAssertTrue(l.isSignalled()); |
1053 |
< |
|
1054 |
< |
} catch (InterruptedException e) { |
1055 |
< |
threadUnexpectedException(); |
1056 |
< |
} |
1057 |
< |
} |
1058 |
< |
}); |
954 |
> |
Thread t = new Thread(new CheckedRunnable() { |
955 |
> |
public void realRun() throws InterruptedException { |
956 |
> |
threadAssertFalse(l.isSignalled()); |
957 |
> |
threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000)); |
958 |
> |
threadAssertTrue(l.isSignalled()); |
959 |
> |
}}); |
960 |
|
|
961 |
|
t.start(); |
962 |
|
assertFalse(l.isSignalled()); |
971 |
|
*/ |
972 |
|
public void testAcquireSharedInterruptibly_InterruptedException() throws InterruptedException { |
973 |
|
final BooleanLatch l = new BooleanLatch(); |
974 |
< |
Thread t = new Thread(new Runnable() { |
975 |
< |
public void run() { |
976 |
< |
try { |
977 |
< |
threadAssertFalse(l.isSignalled()); |
978 |
< |
l.acquireSharedInterruptibly(0); |
979 |
< |
threadShouldThrow(); |
1079 |
< |
} catch (InterruptedException success) {} |
1080 |
< |
} |
1081 |
< |
}); |
974 |
> |
Thread t = new Thread(new CheckedInterruptedRunnable() { |
975 |
> |
public void realRun() throws InterruptedException { |
976 |
> |
threadAssertFalse(l.isSignalled()); |
977 |
> |
l.acquireSharedInterruptibly(0); |
978 |
> |
}}); |
979 |
> |
|
980 |
|
t.start(); |
981 |
|
assertFalse(l.isSignalled()); |
982 |
|
t.interrupt(); |
988 |
|
*/ |
989 |
|
public void testAcquireSharedNanos_InterruptedException() throws InterruptedException { |
990 |
|
final BooleanLatch l = new BooleanLatch(); |
991 |
< |
Thread t = new Thread(new Runnable() { |
992 |
< |
public void run() { |
993 |
< |
try { |
994 |
< |
threadAssertFalse(l.isSignalled()); |
995 |
< |
l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000); |
996 |
< |
threadShouldThrow(); |
1099 |
< |
} catch (InterruptedException success) {} |
1100 |
< |
} |
1101 |
< |
}); |
991 |
> |
Thread t = new Thread(new CheckedInterruptedRunnable() { |
992 |
> |
public void realRun() throws InterruptedException { |
993 |
> |
threadAssertFalse(l.isSignalled()); |
994 |
> |
l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000); |
995 |
> |
}}); |
996 |
> |
|
997 |
|
t.start(); |
998 |
|
Thread.sleep(SHORT_DELAY_MS); |
999 |
|
assertFalse(l.isSignalled()); |
1006 |
|
*/ |
1007 |
|
public void testAcquireSharedNanos_Timeout() throws InterruptedException { |
1008 |
|
final BooleanLatch l = new BooleanLatch(); |
1009 |
< |
Thread t = new Thread(new Runnable() { |
1010 |
< |
public void run() { |
1011 |
< |
try { |
1012 |
< |
threadAssertFalse(l.isSignalled()); |
1013 |
< |
threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000)); |
1014 |
< |
} catch (InterruptedException ie) { |
1120 |
< |
threadUnexpectedException(); |
1121 |
< |
} |
1122 |
< |
} |
1123 |
< |
}); |
1009 |
> |
Thread t = new Thread(new CheckedRunnable() { |
1010 |
> |
public void realRun() throws InterruptedException { |
1011 |
> |
threadAssertFalse(l.isSignalled()); |
1012 |
> |
threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000)); |
1013 |
> |
}}); |
1014 |
> |
|
1015 |
|
t.start(); |
1016 |
|
Thread.sleep(SHORT_DELAY_MS); |
1017 |
|
assertFalse(l.isSignalled()); |
1018 |
|
t.join(); |
1019 |
|
} |
1020 |
|
|
1130 |
– |
|
1021 |
|
} |