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 |
|
} |
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 |
|
} |
490 |
|
t.interrupt(); |
491 |
|
assertTrue(sync.isHeldExclusively()); |
492 |
|
t.join(); |
493 |
< |
} catch (Exception e){ |
493 |
> |
} catch (Exception e) { |
494 |
|
unexpectedException(); |
495 |
|
} |
496 |
|
} |
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 |
|
} |
1190 |
|
l.releaseShared(0); |
1191 |
|
assertTrue(l.isSignalled()); |
1192 |
|
t.join(); |
1193 |
< |
} catch (InterruptedException e){ |
1193 |
> |
} catch (InterruptedException e) { |
1194 |
|
unexpectedException(); |
1195 |
|
} |
1196 |
|
} |
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 |
|
} |
1221 |
|
l.releaseShared(0); |
1222 |
|
assertTrue(l.isSignalled()); |
1223 |
|
t.join(); |
1224 |
< |
} catch (InterruptedException e){ |
1224 |
> |
} catch (InterruptedException e) { |
1225 |
|
unexpectedException(); |
1226 |
|
} |
1227 |
|
} |
1237 |
|
threadAssertFalse(l.isSignalled()); |
1238 |
|
l.acquireSharedInterruptibly(0); |
1239 |
|
threadShouldThrow(); |
1240 |
< |
} catch (InterruptedException success){} |
1240 |
> |
} catch (InterruptedException success) {} |
1241 |
|
} |
1242 |
|
}); |
1243 |
|
t.start(); |
1245 |
|
assertFalse(l.isSignalled()); |
1246 |
|
t.interrupt(); |
1247 |
|
t.join(); |
1248 |
< |
} catch (InterruptedException e){ |
1248 |
> |
} catch (InterruptedException e) { |
1249 |
|
unexpectedException(); |
1250 |
|
} |
1251 |
|
} |
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(); |
1270 |
|
assertFalse(l.isSignalled()); |
1271 |
|
t.interrupt(); |
1272 |
|
t.join(); |
1273 |
< |
} catch (InterruptedException e){ |
1273 |
> |
} catch (InterruptedException e) { |
1274 |
|
unexpectedException(); |
1275 |
|
} |
1276 |
|
} |
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 |
|
} |
1295 |
|
Thread.sleep(SHORT_DELAY_MS); |
1296 |
|
assertFalse(l.isSignalled()); |
1297 |
|
t.join(); |
1298 |
< |
} catch (InterruptedException e){ |
1298 |
> |
} catch (InterruptedException e) { |
1299 |
|
unexpectedException(); |
1300 |
|
} |
1301 |
|
} |