913 |
|
} |
914 |
|
|
915 |
|
void runAsync(Runnable r1, Runnable r2) { |
916 |
< |
boolean b = ThreadLocalRandom.current().nextBoolean(); |
916 |
> |
boolean b = randomBoolean(); |
917 |
|
CompletableFuture<Void> f1 = CompletableFuture.runAsync(b ? r1 : r2); |
918 |
|
CompletableFuture<Void> f2 = CompletableFuture.runAsync(b ? r2 : r1); |
919 |
|
f1.join(); |
976 |
|
} |
977 |
|
} |
978 |
|
|
979 |
– |
<T> T chooseRandomly(T... choices) { |
980 |
– |
return choices[ThreadLocalRandom.current().nextInt(choices.length)]; |
981 |
– |
} |
982 |
– |
|
979 |
|
/** |
980 |
|
* Non-traversing Deque operations (that return null) are linearizable. |
981 |
|
* Don't return null when the deque is observably never empty. |