76 |
|
public void run() { |
77 |
|
try { |
78 |
|
sync.acquireInterruptibly(1); |
79 |
< |
} catch(InterruptedException success){} |
79 |
> |
} catch (InterruptedException success){} |
80 |
|
} |
81 |
|
} |
82 |
|
|
92 |
|
try { |
93 |
|
sync.acquireInterruptibly(1); |
94 |
|
threadShouldThrow(); |
95 |
< |
} catch(InterruptedException success){} |
95 |
> |
} catch (InterruptedException success){} |
96 |
|
} |
97 |
|
} |
98 |
|
|
149 |
|
assertFalse(sync.hasQueuedThreads()); |
150 |
|
t1.join(); |
151 |
|
t2.join(); |
152 |
< |
} catch(Exception e){ |
152 |
> |
} catch (Exception e){ |
153 |
|
unexpectedException(); |
154 |
|
} |
155 |
|
} |
195 |
|
assertFalse(sync.isQueued(t2)); |
196 |
|
t1.join(); |
197 |
|
t2.join(); |
198 |
< |
} catch(Exception e){ |
198 |
> |
} catch (Exception e){ |
199 |
|
unexpectedException(); |
200 |
|
} |
201 |
|
} |
225 |
|
assertNull(sync.getFirstQueuedThread()); |
226 |
|
t1.join(); |
227 |
|
t2.join(); |
228 |
< |
} catch(Exception e){ |
228 |
> |
} catch (Exception e){ |
229 |
|
unexpectedException(); |
230 |
|
} |
231 |
|
} |
255 |
|
assertTrue(sync.hasContended()); |
256 |
|
t1.join(); |
257 |
|
t2.join(); |
258 |
< |
} catch(Exception e){ |
258 |
> |
} catch (Exception e){ |
259 |
|
unexpectedException(); |
260 |
|
} |
261 |
|
} |
287 |
|
assertTrue(sync.getQueuedThreads().isEmpty()); |
288 |
|
t1.join(); |
289 |
|
t2.join(); |
290 |
< |
} catch(Exception e){ |
290 |
> |
} catch (Exception e){ |
291 |
|
unexpectedException(); |
292 |
|
} |
293 |
|
} |
319 |
|
assertTrue(sync.getExclusiveQueuedThreads().isEmpty()); |
320 |
|
t1.join(); |
321 |
|
t2.join(); |
322 |
< |
} catch(Exception e){ |
322 |
> |
} catch (Exception e){ |
323 |
|
unexpectedException(); |
324 |
|
} |
325 |
|
} |
349 |
|
assertTrue(sync.getSharedQueuedThreads().isEmpty()); |
350 |
|
t1.join(); |
351 |
|
t2.join(); |
352 |
< |
} catch(Exception e){ |
352 |
> |
} catch (Exception e){ |
353 |
|
unexpectedException(); |
354 |
|
} |
355 |
|
} |
365 |
|
try { |
366 |
|
sync.tryAcquireNanos(1, MEDIUM_DELAY_MS * 1000 * 1000); |
367 |
|
threadShouldThrow(); |
368 |
< |
} catch(InterruptedException success){} |
368 |
> |
} catch (InterruptedException success){} |
369 |
|
} |
370 |
|
}); |
371 |
|
try { |
372 |
|
t.start(); |
373 |
|
t.interrupt(); |
374 |
< |
} catch(Exception e){ |
374 |
> |
} catch (Exception e){ |
375 |
|
unexpectedException(); |
376 |
|
} |
377 |
|
} |
392 |
|
t.start(); |
393 |
|
t.join(); |
394 |
|
sync.release(1); |
395 |
< |
} catch(Exception e){ |
395 |
> |
} catch (Exception e){ |
396 |
|
unexpectedException(); |
397 |
|
} |
398 |
|
} |
416 |
|
t.start(); |
417 |
|
t.join(); |
418 |
|
sync.release(1); |
419 |
< |
} catch(Exception e){ |
419 |
> |
} catch (Exception e){ |
420 |
|
unexpectedException(); |
421 |
|
} |
422 |
|
} |
437 |
|
try { |
438 |
|
Thread.sleep(SMALL_DELAY_MS); |
439 |
|
} |
440 |
< |
catch(Exception e) { |
440 |
> |
catch (Exception e) { |
441 |
|
threadUnexpectedException(); |
442 |
|
} |
443 |
|
sync.release(1); |
449 |
|
assertTrue(sync.isHeldExclusively()); |
450 |
|
t.join(); |
451 |
|
assertFalse(sync.isHeldExclusively()); |
452 |
< |
} catch(Exception e){ |
452 |
> |
} catch (Exception e){ |
453 |
|
unexpectedException(); |
454 |
|
} |
455 |
|
} |
469 |
|
Thread.sleep(SHORT_DELAY_MS); |
470 |
|
sync.release(1); |
471 |
|
t.join(); |
472 |
< |
} catch(Exception e){ |
472 |
> |
} catch (Exception e){ |
473 |
|
unexpectedException(); |
474 |
|
} |
475 |
|
} |
481 |
|
final Mutex sync = new Mutex(); |
482 |
|
try { |
483 |
|
sync.acquireInterruptibly(1); |
484 |
< |
} catch(Exception e) { |
484 |
> |
} catch (Exception e) { |
485 |
|
unexpectedException(); |
486 |
|
} |
487 |
|
Thread t = new Thread(new InterruptedSyncRunnable(sync)); |
490 |
|
t.interrupt(); |
491 |
|
assertTrue(sync.isHeldExclusively()); |
492 |
|
t.join(); |
493 |
< |
} catch(Exception e){ |
493 |
> |
} catch (Exception e){ |
494 |
|
unexpectedException(); |
495 |
|
} |
496 |
|
} |
603 |
|
c.await(); |
604 |
|
sync.release(1); |
605 |
|
} |
606 |
< |
catch(InterruptedException e) { |
606 |
> |
catch (InterruptedException e) { |
607 |
|
threadUnexpectedException(); |
608 |
|
} |
609 |
|
} |
781 |
|
c.await(); |
782 |
|
sync.release(1); |
783 |
|
} |
784 |
< |
catch(InterruptedException e) { |
784 |
> |
catch (InterruptedException e) { |
785 |
|
threadUnexpectedException(); |
786 |
|
} |
787 |
|
} |
823 |
|
c.await(); |
824 |
|
sync.release(1); |
825 |
|
} |
826 |
< |
catch(InterruptedException e) { |
826 |
> |
catch (InterruptedException e) { |
827 |
|
threadUnexpectedException(); |
828 |
|
} |
829 |
|
} |
838 |
|
c.await(); |
839 |
|
sync.release(1); |
840 |
|
} |
841 |
< |
catch(InterruptedException e) { |
841 |
> |
catch (InterruptedException e) { |
842 |
|
threadUnexpectedException(); |
843 |
|
} |
844 |
|
} |
883 |
|
c.await(); |
884 |
|
sync.release(1); |
885 |
|
} |
886 |
< |
catch(InterruptedException e) { |
886 |
> |
catch (InterruptedException e) { |
887 |
|
threadUnexpectedException(); |
888 |
|
} |
889 |
|
} |
897 |
|
c.await(); |
898 |
|
sync.release(1); |
899 |
|
} |
900 |
< |
catch(InterruptedException e) { |
900 |
> |
catch (InterruptedException e) { |
901 |
|
threadUnexpectedException(); |
902 |
|
} |
903 |
|
} |
977 |
|
sync.release(1); |
978 |
|
threadShouldThrow(); |
979 |
|
} |
980 |
< |
catch(InterruptedException success) { |
980 |
> |
catch (InterruptedException success) { |
981 |
|
} |
982 |
|
} |
983 |
|
}); |
1008 |
|
sync.release(1); |
1009 |
|
threadShouldThrow(); |
1010 |
|
} |
1011 |
< |
catch(InterruptedException success) { |
1011 |
> |
catch (InterruptedException success) { |
1012 |
|
} |
1013 |
|
} |
1014 |
|
}); |
1040 |
|
sync.release(1); |
1041 |
|
threadShouldThrow(); |
1042 |
|
} |
1043 |
< |
catch(InterruptedException success) { |
1043 |
> |
catch (InterruptedException success) { |
1044 |
|
} |
1045 |
|
} |
1046 |
|
}); |
1070 |
|
c.await(); |
1071 |
|
sync.release(1); |
1072 |
|
} |
1073 |
< |
catch(InterruptedException e) { |
1073 |
> |
catch (InterruptedException e) { |
1074 |
|
threadUnexpectedException(); |
1075 |
|
} |
1076 |
|
} |
1083 |
|
c.await(); |
1084 |
|
sync.release(1); |
1085 |
|
} |
1086 |
< |
catch(InterruptedException e) { |
1086 |
> |
catch (InterruptedException e) { |
1087 |
|
threadUnexpectedException(); |
1088 |
|
} |
1089 |
|
} |
1137 |
|
ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin)); |
1138 |
|
Mutex r = (Mutex) in.readObject(); |
1139 |
|
assertTrue(r.isHeldExclusively()); |
1140 |
< |
} catch(Exception e){ |
1140 |
> |
} catch (Exception e){ |
1141 |
|
e.printStackTrace(); |
1142 |
|
unexpectedException(); |
1143 |
|
} |
1178 |
|
threadAssertFalse(l.isSignalled()); |
1179 |
|
l.acquireSharedInterruptibly(0); |
1180 |
|
threadAssertTrue(l.isSignalled()); |
1181 |
< |
} catch(InterruptedException e){ |
1181 |
> |
} catch (InterruptedException e){ |
1182 |
|
threadUnexpectedException(); |
1183 |
|
} |
1184 |
|
} |
1209 |
|
threadAssertTrue(l.tryAcquireSharedNanos(0, MEDIUM_DELAY_MS* 1000 * 1000)); |
1210 |
|
threadAssertTrue(l.isSignalled()); |
1211 |
|
|
1212 |
< |
} catch(InterruptedException e){ |
1212 |
> |
} catch (InterruptedException e){ |
1213 |
|
threadUnexpectedException(); |
1214 |
|
} |
1215 |
|
} |
1237 |
|
threadAssertFalse(l.isSignalled()); |
1238 |
|
l.acquireSharedInterruptibly(0); |
1239 |
|
threadShouldThrow(); |
1240 |
< |
} catch(InterruptedException success){} |
1240 |
> |
} catch (InterruptedException success){} |
1241 |
|
} |
1242 |
|
}); |
1243 |
|
t.start(); |
1261 |
|
threadAssertFalse(l.isSignalled()); |
1262 |
|
l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000); |
1263 |
|
threadShouldThrow(); |
1264 |
< |
} catch(InterruptedException success){} |
1264 |
> |
} catch (InterruptedException success){} |
1265 |
|
} |
1266 |
|
}); |
1267 |
|
t.start(); |
1285 |
|
try { |
1286 |
|
threadAssertFalse(l.isSignalled()); |
1287 |
|
threadAssertFalse(l.tryAcquireSharedNanos(0, SMALL_DELAY_MS* 1000 * 1000)); |
1288 |
< |
} catch(InterruptedException ie){ |
1288 |
> |
} catch (InterruptedException ie){ |
1289 |
|
threadUnexpectedException(); |
1290 |
|
} |
1291 |
|
} |