1265 |
|
|
1266 |
|
// A synchronizer only offering a choice of failure modes |
1267 |
|
class Sync extends AbstractQueuedLongSynchronizer { |
1268 |
< |
boolean pleaseThrow; |
1268 |
> |
volatile boolean pleaseThrow; |
1269 |
|
@Override protected boolean tryAcquire(long ignored) { |
1270 |
|
if (pleaseThrow) throw ex; |
1271 |
|
return false; |
1287 |
|
final Thread thread = newStartedThread(new CheckedRunnable() { |
1288 |
|
public void realRun() { |
1289 |
|
try { |
1290 |
< |
if (ThreadLocalRandom.current().nextBoolean()) |
1290 |
> |
if (randomBoolean()) |
1291 |
|
s.acquire(1); |
1292 |
|
else |
1293 |
|
s.acquireShared(1); |