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

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

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

revision 1.1, Wed Oct 6 07:49:22 2010 UTC revision 1.2, Thu Oct 28 17:57:26 2010 UTC
# Line 71  Line 71 
71          awaitTermination(t, MEDIUM_DELAY_MS);          awaitTermination(t, MEDIUM_DELAY_MS);
72      }      }
73    
74        /**
75         * take blocks interruptibly when empty
76         */
77        public void testTakeFromEmptyBlocksInterruptibly()
78                throws InterruptedException {
79            final BlockingQueue q = emptyCollection();
80            final CountDownLatch threadStarted = new CountDownLatch(1);
81            Thread t = newStartedThread(new CheckedRunnable() {
82                public void realRun() {
83                    long t0 = System.nanoTime();
84                    threadStarted.countDown();
85                    try {
86                        q.take();
87                        shouldThrow();
88                    } catch (InterruptedException success) {}
89                    assertTrue(millisElapsedSince(t0) >= SHORT_DELAY_MS);
90                }});
91            threadStarted.await();
92            Thread.sleep(SHORT_DELAY_MS);
93            assertTrue(t.isAlive());
94            t.interrupt();
95            awaitTermination(t, MEDIUM_DELAY_MS);
96            assertFalse(t.isAlive());
97        }
98    
99      /** For debugging. */      /** For debugging. */
100      public void XXXXtestFails() {      public void XXXXtestFails() {
101          fail(emptyCollection().getClass().toString());          fail(emptyCollection().getClass().toString());

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8