--- jsr166/src/test/tck/SemaphoreTest.java 2017/05/14 03:31:53 1.39 +++ jsr166/src/test/tck/SemaphoreTest.java 2017/05/14 03:48:35 1.40 @@ -195,8 +195,7 @@ public class SemaphoreTest extends JSR16 * timed tryAcquire times out */ public void testTryAcquire_timeout() { - final ThreadLocalRandom rnd = ThreadLocalRandom.current(); - final boolean fair = rnd.nextBoolean(); + final boolean fair = ThreadLocalRandom.current().nextBoolean(); final Semaphore s = new Semaphore(0, fair); final long startTime = System.nanoTime(); try { assertFalse(s.tryAcquire(timeoutMillis(), MILLISECONDS)); } @@ -208,8 +207,7 @@ public class SemaphoreTest extends JSR16 * timed tryAcquire(N) times out */ public void testTryAcquireN_timeout() { - final ThreadLocalRandom rnd = ThreadLocalRandom.current(); - final boolean fair = rnd.nextBoolean(); + final boolean fair = ThreadLocalRandom.current().nextBoolean(); final Semaphore s = new Semaphore(2, fair); final long startTime = System.nanoTime(); try { assertFalse(s.tryAcquire(3, timeoutMillis(), MILLISECONDS)); }