73 |
|
public void run() { |
74 |
|
try { |
75 |
|
sync.acquireInterruptibly(1); |
76 |
< |
} catch(InterruptedException success){} |
76 |
> |
} catch (InterruptedException success){} |
77 |
|
} |
78 |
|
} |
79 |
|
|
89 |
|
try { |
90 |
|
sync.acquireInterruptibly(1); |
91 |
|
threadShouldThrow(); |
92 |
< |
} catch(InterruptedException success){} |
92 |
> |
} catch (InterruptedException success){} |
93 |
|
} |
94 |
|
} |
95 |
|
|
146 |
|
assertFalse(sync.hasQueuedThreads()); |
147 |
|
t1.join(); |
148 |
|
t2.join(); |
149 |
< |
} catch(Exception e){ |
149 |
> |
} catch (Exception e){ |
150 |
|
unexpectedException(); |
151 |
|
} |
152 |
|
} |
192 |
|
assertFalse(sync.isQueued(t2)); |
193 |
|
t1.join(); |
194 |
|
t2.join(); |
195 |
< |
} catch(Exception e){ |
195 |
> |
} catch (Exception e){ |
196 |
|
unexpectedException(); |
197 |
|
} |
198 |
|
} |
222 |
|
assertNull(sync.getFirstQueuedThread()); |
223 |
|
t1.join(); |
224 |
|
t2.join(); |
225 |
< |
} catch(Exception e){ |
225 |
> |
} catch (Exception e){ |
226 |
|
unexpectedException(); |
227 |
|
} |
228 |
|
} |
252 |
|
assertTrue(sync.hasContended()); |
253 |
|
t1.join(); |
254 |
|
t2.join(); |
255 |
< |
} catch(Exception e){ |
255 |
> |
} catch (Exception e){ |
256 |
|
unexpectedException(); |
257 |
|
} |
258 |
|
} |
284 |
|
assertTrue(sync.getQueuedThreads().isEmpty()); |
285 |
|
t1.join(); |
286 |
|
t2.join(); |
287 |
< |
} catch(Exception e){ |
287 |
> |
} catch (Exception e){ |
288 |
|
unexpectedException(); |
289 |
|
} |
290 |
|
} |
316 |
|
assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); |
317 |
|
t1.join(); |
318 |
|
t2.join(); |
319 |
< |
} catch(Exception e){ |
319 |
> |
} catch (Exception e){ |
320 |
|
unexpectedException(); |
321 |
|
} |
322 |
|
} |
346 |
|
assertTrue(sync.getSharedQueuedThreads().isEmpty()); |
347 |
|
t1.join(); |
348 |
|
t2.join(); |
349 |
< |
} catch(Exception e){ |
349 |
> |
} catch (Exception e){ |
350 |
|
unexpectedException(); |
351 |
|
} |
352 |
|
} |
362 |
|
try { |
363 |
|
sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000); |
364 |
|
threadShouldThrow(); |
365 |
< |
} catch(InterruptedException success){} |
365 |
> |
} catch (InterruptedException success){} |
366 |
|
} |
367 |
|
}); |
368 |
|
try { |
369 |
|
t.start(); |
370 |
|
t.interrupt(); |
371 |
< |
} catch(Exception e){ |
371 |
> |
} catch (Exception e){ |
372 |
|
unexpectedException(); |
373 |
|
} |
374 |
|
} |
389 |
|
t.start(); |
390 |
|
t.join(); |
391 |
|
sync.release(1); |
392 |
< |
} catch(Exception e){ |
392 |
> |
} catch (Exception e){ |
393 |
|
unexpectedException(); |
394 |
|
} |
395 |
|
} |
413 |
|
t.start(); |
414 |
|
t.join(); |
415 |
|
sync.release(1); |
416 |
< |
} catch(Exception e){ |
416 |
> |
} catch (Exception e){ |
417 |
|
unexpectedException(); |
418 |
|
} |
419 |
|
} |
434 |
|
try { |
435 |
|
Thread.sleep(SMALL_DELAY_MS); |
436 |
|
} |
437 |
< |
catch(Exception e) { |
437 |
> |
catch (Exception e) { |
438 |
|
threadUnexpectedException(); |
439 |
|
} |
440 |
|
sync.release(1); |
446 |
|
assertTrue(sync.isHeldExclusively()); |
447 |
|
t.join(); |
448 |
|
assertFalse(sync.isHeldExclusively()); |
449 |
< |
} catch(Exception e){ |
449 |
> |
} catch (Exception e){ |
450 |
|
unexpectedException(); |
451 |
|
} |
452 |
|
} |
466 |
|
Thread.sleep(SHORT_DELAY_MS); |
467 |
|
sync.release(1); |
468 |
|
t.join(); |
469 |
< |
} catch(Exception e){ |
469 |
> |
} catch (Exception e){ |
470 |
|
unexpectedException(); |
471 |
|
} |
472 |
|
} |
478 |
|
final Mutex sync = new Mutex(); |
479 |
|
try { |
480 |
|
sync.acquireInterruptibly(1); |
481 |
< |
} catch(Exception e) { |
481 |
> |
} catch (Exception e) { |
482 |
|
unexpectedException(); |
483 |
|
} |
484 |
|
Thread t = new Thread(new InterruptedSyncRunnable(sync)); |
487 |
|
t.interrupt(); |
488 |
|
assertTrue(sync.isHeldExclusively()); |
489 |
|
t.join(); |
490 |
< |
} catch(Exception e){ |
490 |
> |
} catch (Exception e){ |
491 |
|
unexpectedException(); |
492 |
|
} |
493 |
|
} |
600 |
|
c.await(); |
601 |
|
sync.release(1); |
602 |
|
} |
603 |
< |
catch(InterruptedException e) { |
603 |
> |
catch (InterruptedException e) { |
604 |
|
threadUnexpectedException(); |
605 |
|
} |
606 |
|
} |
778 |
|
c.await(); |
779 |
|
sync.release(1); |
780 |
|
} |
781 |
< |
catch(InterruptedException e) { |
781 |
> |
catch (InterruptedException e) { |
782 |
|
threadUnexpectedException(); |
783 |
|
} |
784 |
|
} |
820 |
|
c.await(); |
821 |
|
sync.release(1); |
822 |
|
} |
823 |
< |
catch(InterruptedException e) { |
823 |
> |
catch (InterruptedException e) { |
824 |
|
threadUnexpectedException(); |
825 |
|
} |
826 |
|
} |
835 |
|
c.await(); |
836 |
|
sync.release(1); |
837 |
|
} |
838 |
< |
catch(InterruptedException e) { |
838 |
> |
catch (InterruptedException e) { |
839 |
|
threadUnexpectedException(); |
840 |
|
} |
841 |
|
} |
880 |
|
c.await(); |
881 |
|
sync.release(1); |
882 |
|
} |
883 |
< |
catch(InterruptedException e) { |
883 |
> |
catch (InterruptedException e) { |
884 |
|
threadUnexpectedException(); |
885 |
|
} |
886 |
|
} |
894 |
|
c.await(); |
895 |
|
sync.release(1); |
896 |
|
} |
897 |
< |
catch(InterruptedException e) { |
897 |
> |
catch (InterruptedException e) { |
898 |
|
threadUnexpectedException(); |
899 |
|
} |
900 |
|
} |
974 |
|
sync.release(1); |
975 |
|
threadShouldThrow(); |
976 |
|
} |
977 |
< |
catch(InterruptedException success) { |
977 |
> |
catch (InterruptedException success) { |
978 |
|
} |
979 |
|
} |
980 |
|
}); |
1005 |
|
sync.release(1); |
1006 |
|
threadShouldThrow(); |
1007 |
|
} |
1008 |
< |
catch(InterruptedException success) { |
1008 |
> |
catch (InterruptedException success) { |
1009 |
|
} |
1010 |
|
} |
1011 |
|
}); |
1037 |
|
sync.release(1); |
1038 |
|
threadShouldThrow(); |
1039 |
|
} |
1040 |
< |
catch(InterruptedException success) { |
1040 |
> |
catch (InterruptedException success) { |
1041 |
|
} |
1042 |
|
} |
1043 |
|
}); |
1067 |
|
c.await(); |
1068 |
|
sync.release(1); |
1069 |
|
} |
1070 |
< |
catch(InterruptedException e) { |
1070 |
> |
catch (InterruptedException e) { |
1071 |
|
threadUnexpectedException(); |
1072 |
|
} |
1073 |
|
} |
1080 |
|
c.await(); |
1081 |
|
sync.release(1); |
1082 |
|
} |
1083 |
< |
catch(InterruptedException e) { |
1083 |
> |
catch (InterruptedException e) { |
1084 |
|
threadUnexpectedException(); |
1085 |
|
} |
1086 |
|
} |
1134 |
|
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
1135 |
|
Mutex r = (Mutex) in.readObject(); |
1136 |
|
assertTrue(r.isHeldExclusively()); |
1137 |
< |
} catch(Exception e){ |
1137 |
> |
} catch (Exception e){ |
1138 |
|
e.printStackTrace(); |
1139 |
|
unexpectedException(); |
1140 |
|
} |
1175 |
|
threadAssertFalse(l.isSignalled()); |
1176 |
|
l.acquireSharedInterruptibly(0); |
1177 |
|
threadAssertTrue(l.isSignalled()); |
1178 |
< |
} catch(InterruptedException e){ |
1178 |
> |
} catch (InterruptedException e){ |
1179 |
|
threadUnexpectedException(); |
1180 |
|
} |
1181 |
|
} |
1206 |
|
threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000)); |
1207 |
|
threadAssertTrue(l.isSignalled()); |
1208 |
|
|
1209 |
< |
} catch(InterruptedException e){ |
1209 |
> |
} catch (InterruptedException e){ |
1210 |
|
threadUnexpectedException(); |
1211 |
|
} |
1212 |
|
} |
1234 |
|
threadAssertFalse(l.isSignalled()); |
1235 |
|
l.acquireSharedInterruptibly(0); |
1236 |
|
threadShouldThrow(); |
1237 |
< |
} catch(InterruptedException success){} |
1237 |
> |
} catch (InterruptedException success){} |
1238 |
|
} |
1239 |
|
}); |
1240 |
|
t.start(); |
1258 |
|
threadAssertFalse(l.isSignalled()); |
1259 |
|
l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000); |
1260 |
|
threadShouldThrow(); |
1261 |
< |
} catch(InterruptedException success){} |
1261 |
> |
} catch (InterruptedException success){} |
1262 |
|
} |
1263 |
|
}); |
1264 |
|
t.start(); |
1282 |
|
try { |
1283 |
|
threadAssertFalse(l.isSignalled()); |
1284 |
|
threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000)); |
1285 |
< |
} catch(InterruptedException ie){ |
1285 |
> |
} catch (InterruptedException ie){ |
1286 |
|
threadUnexpectedException(); |
1287 |
|
} |
1288 |
|
} |