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

Comparing jsr166/src/test/tck/ThreadPoolExecutorTest.java (file contents):
Revision 1.29 by jsr166, Fri Nov 20 16:02:10 2009 UTC vs.
Revision 1.30 by jsr166, Fri Nov 20 22:58:48 2009 UTC

# Line 1228 | Line 1228 | public class ThreadPoolExecutorTest exte
1228       * timed invokeAny(c) throws NPE if c has null elements
1229       */
1230      public void testTimedInvokeAny3() throws Exception {
1231 +        final CountDownLatch latch = new CountDownLatch(1);
1232          ExecutorService e = new ThreadPoolExecutor(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1233          try {
1234              ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1235 <            l.add(new StringTask());
1235 >            l.add(new Callable<String>() {
1236 >                      public String call() {
1237 >                          try {
1238 >                              latch.await();
1239 >                          } catch (InterruptedException ok) {}
1240 >                          return TEST_STRING;
1241 >                      }});
1242              l.add(null);
1243              e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1244              shouldThrow();
1245          } catch (NullPointerException success) {
1246          } finally {
1247 +            latch.countDown();
1248              joinPool(e);
1249          }
1250      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines