23 |
|
|
24 |
|
public class ReentrantReadWriteLockTest extends JSR166TestCase { |
25 |
|
public static void main(String[] args) { |
26 |
< |
junit.textui.TestRunner.run(suite()); |
26 |
> |
main(suite(), args); |
27 |
|
} |
28 |
|
public static Test suite() { |
29 |
|
return new TestSuite(ReentrantReadWriteLockTest.class); |
830 |
|
new PublicReentrantReadWriteLock(fair); |
831 |
|
try { |
832 |
|
lock.writeLock().lockInterruptibly(); |
833 |
< |
} catch (InterruptedException ie) { |
834 |
< |
threadUnexpectedException(ie); |
835 |
< |
} |
833 |
> |
} catch (InterruptedException fail) { threadUnexpectedException(fail); } |
834 |
|
Thread t = newStartedThread(new CheckedInterruptedRunnable() { |
835 |
|
public void realRun() throws InterruptedException { |
836 |
|
lock.writeLock().lockInterruptibly(); |
855 |
|
lock.readLock().lockInterruptibly(); |
856 |
|
lock.readLock().unlock(); |
857 |
|
lock.writeLock().lockInterruptibly(); |
858 |
< |
} catch (InterruptedException ie) { |
861 |
< |
threadUnexpectedException(ie); |
862 |
< |
} |
858 |
> |
} catch (InterruptedException fail) { threadUnexpectedException(fail); } |
859 |
|
Thread t = newStartedThread(new CheckedInterruptedRunnable() { |
860 |
|
public void realRun() throws InterruptedException { |
861 |
|
lock.readLock().lockInterruptibly(); |
881 |
|
await(c, awaitMethod); |
882 |
|
shouldThrow(); |
883 |
|
} catch (IllegalMonitorStateException success) { |
884 |
< |
} catch (InterruptedException e) { threadUnexpectedException(e); } |
884 |
> |
} catch (InterruptedException fail) { |
885 |
> |
threadUnexpectedException(fail); |
886 |
> |
} |
887 |
|
assertTrue(millisElapsedSince(startTime) < LONG_DELAY_MS); |
888 |
|
} |
889 |
|
} |
934 |
|
assertTrue(nanosRemaining <= 0); |
935 |
|
assertTrue(millisElapsedSince(startTime) >= timeoutMillis); |
936 |
|
lock.writeLock().unlock(); |
937 |
< |
} catch (InterruptedException e) { |
940 |
< |
threadUnexpectedException(e); |
941 |
< |
} |
937 |
> |
} catch (InterruptedException fail) { threadUnexpectedException(fail); } |
938 |
|
} |
939 |
|
|
940 |
|
/** |
953 |
|
assertFalse(c.await(timeoutMillis, MILLISECONDS)); |
954 |
|
assertTrue(millisElapsedSince(startTime) >= timeoutMillis); |
955 |
|
lock.writeLock().unlock(); |
956 |
< |
} catch (InterruptedException e) { |
961 |
< |
threadUnexpectedException(e); |
962 |
< |
} |
956 |
> |
} catch (InterruptedException fail) { threadUnexpectedException(fail); } |
957 |
|
} |
958 |
|
|
959 |
|
/** |
973 |
|
assertFalse(c.awaitUntil(new java.util.Date(d.getTime() + timeoutMillis))); |
974 |
|
assertTrue(millisElapsedSince(startTime) >= timeoutMillis); |
975 |
|
lock.writeLock().unlock(); |
976 |
< |
} catch (InterruptedException e) { |
983 |
< |
threadUnexpectedException(e); |
984 |
< |
} |
976 |
> |
} catch (InterruptedException fail) { threadUnexpectedException(fail); } |
977 |
|
} |
978 |
|
|
979 |
|
/** |