[cvs] / jsr166 / src / test / tck / ArrayBlockingQueueTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/ArrayBlockingQueueTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45, Fri May 6 11:22:07 2011 UTC revision 1.46, Sat May 21 06:24:33 2011 UTC
# Line 365  Line 365 
365       */       */
366      public void testTimedOffer() throws InterruptedException {      public void testTimedOffer() throws InterruptedException {
367          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);          final ArrayBlockingQueue q = new ArrayBlockingQueue(2);
368          Thread t = new Thread(new CheckedRunnable() {          final CountDownLatch pleaseInterrupt = new CountDownLatch(1);
369            Thread t = newStartedThread(new CheckedRunnable() {
370              public void realRun() throws InterruptedException {              public void realRun() throws InterruptedException {
371                  q.put(new Object());                  q.put(new Object());
372                  q.put(new Object());                  q.put(new Object());
373                  assertFalse(q.offer(new Object(), SHORT_DELAY_MS/2, MILLISECONDS));                  long startTime = System.nanoTime();
374                    assertFalse(q.offer(new Object(), timeoutMillis(), MILLISECONDS));
375                    assertTrue(millisElapsedSince(startTime) >= timeoutMillis());
376                    pleaseInterrupt.countDown();
377                  try {                  try {
378                      q.offer(new Object(), LONG_DELAY_MS, MILLISECONDS);                      q.offer(new Object(), 2 * LONG_DELAY_MS, MILLISECONDS);
379                      shouldThrow();                      shouldThrow();
380                  } catch (InterruptedException success) {}                  } catch (InterruptedException success) {}
381              }});              }});
382    
383          t.start();          await(pleaseInterrupt);
         delay(SHORT_DELAY_MS);  
384          t.interrupt();          t.interrupt();
385          t.join();          awaitTermination(t);
386      }      }
387    
388      /**      /**

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8