1283 |
|
try { |
1284 |
|
s.acquireInterruptibly(1); |
1285 |
|
shouldThrow(); |
1286 |
< |
} catch (InterruptedException expected) {} |
1286 |
> |
} catch (InterruptedException success) {} |
1287 |
|
}; |
1288 |
|
for (int i = 0; i < 2; i++) { |
1289 |
|
Thread thread = new Thread(failedAcquire); |
1316 |
|
|
1317 |
|
// A synchronizer only offering a choice of failure modes |
1318 |
|
class Sync extends AbstractQueuedSynchronizer { |
1319 |
< |
boolean pleaseThrow; |
1319 |
> |
volatile boolean pleaseThrow; |
1320 |
|
@Override protected boolean tryAcquire(int ignored) { |
1321 |
|
if (pleaseThrow) throw ex; |
1322 |
|
return false; |
1338 |
|
final Thread thread = newStartedThread(new CheckedRunnable() { |
1339 |
|
public void realRun() { |
1340 |
|
try { |
1341 |
< |
if (ThreadLocalRandom.current().nextBoolean()) |
1341 |
> |
if (randomBoolean()) |
1342 |
|
s.acquire(1); |
1343 |
|
else |
1344 |
|
s.acquireShared(1); |