ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/SynchronousQueueTest.java
(Generate patch)

Comparing jsr166/src/test/tck/SynchronousQueueTest.java (file contents):
Revision 1.63 by jsr166, Sun Aug 11 22:29:27 2019 UTC vs.
Revision 1.65 by jsr166, Tue Aug 13 23:06:39 2019 UTC

# Line 18 | Line 18 | import java.util.concurrent.CountDownLat
18   import java.util.concurrent.Executors;
19   import java.util.concurrent.ExecutorService;
20   import java.util.concurrent.SynchronousQueue;
21 import java.util.concurrent.ThreadLocalRandom;
21  
22   import junit.framework.Test;
23  
# Line 190 | Line 189 | public class SynchronousQueueTest extend
189       * timed offer times out if elements not taken
190       */
191      public void testTimedOffer() {
192 <        final boolean fair = ThreadLocalRandom.current().nextBoolean();
192 >        final boolean fair = randomBoolean();
193          final SynchronousQueue q = new SynchronousQueue(fair);
194          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
195          Thread t = newStartedThread(new CheckedRunnable() {
# Line 248 | Line 247 | public class SynchronousQueueTest extend
247       * timed poll with nonzero timeout times out if no active putter
248       */
249      public void testTimedPoll() {
250 <        final boolean fair = ThreadLocalRandom.current().nextBoolean();
250 >        final boolean fair = randomBoolean();
251          final SynchronousQueue q = new SynchronousQueue(fair);
252          final long startTime = System.nanoTime();
253          try { assertNull(q.poll(timeoutMillis(), MILLISECONDS)); }
# Line 261 | Line 260 | public class SynchronousQueueTest extend
260       * after offer succeeds; on interruption throws
261       */
262      public void testTimedPollWithOffer() {
263 <        final boolean fair = ThreadLocalRandom.current().nextBoolean();
263 >        final boolean fair = randomBoolean();
264          final SynchronousQueue q = new SynchronousQueue(fair);
265          final CountDownLatch pleaseOffer = new CountDownLatch(1);
266          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines