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

Comparing jsr166/src/test/tck/ThreadPoolExecutorSubclassTest.java (file contents):
Revision 1.12 by jsr166, Sat Nov 21 19:44:50 2009 UTC vs.
Revision 1.19 by jsr166, Sat Oct 9 19:30:35 2010 UTC

# Line 192 | Line 192 | public class ThreadPoolExecutorSubclassT
192  
193  
194      /**
195 <     *  execute successfully executes a runnable
195 >     * execute successfully executes a runnable
196       */
197      public void testExecute() throws InterruptedException {
198          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 205 | Line 205 | public class ThreadPoolExecutorSubclassT
205      }
206  
207      /**
208 <     *  getActiveCount increases but doesn't overestimate, when a
209 <     *  thread becomes active
208 >     * getActiveCount increases but doesn't overestimate, when a
209 >     * thread becomes active
210       */
211      public void testGetActiveCount() throws InterruptedException {
212          ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 218 | Line 218 | public class ThreadPoolExecutorSubclassT
218      }
219  
220      /**
221 <     *  prestartCoreThread starts a thread if under corePoolSize, else doesn't
221 >     * prestartCoreThread starts a thread if under corePoolSize, else doesn't
222       */
223      public void testPrestartCoreThread() {
224          ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 233 | Line 233 | public class ThreadPoolExecutorSubclassT
233      }
234  
235      /**
236 <     *  prestartAllCoreThreads starts all corePoolSize threads
236 >     * prestartAllCoreThreads starts all corePoolSize threads
237       */
238      public void testPrestartAllCoreThreads() {
239          ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 246 | Line 246 | public class ThreadPoolExecutorSubclassT
246      }
247  
248      /**
249 <     *   getCompletedTaskCount increases, but doesn't overestimate,
250 <     *   when tasks complete
249 >     * getCompletedTaskCount increases, but doesn't overestimate,
250 >     * when tasks complete
251       */
252      public void testGetCompletedTaskCount() throws InterruptedException {
253          ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 260 | Line 260 | public class ThreadPoolExecutorSubclassT
260      }
261  
262      /**
263 <     *   getCorePoolSize returns size given in constructor if not otherwise set
263 >     * getCorePoolSize returns size given in constructor if not otherwise set
264       */
265      public void testGetCorePoolSize() {
266          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 269 | Line 269 | public class ThreadPoolExecutorSubclassT
269      }
270  
271      /**
272 <     *   getKeepAliveTime returns value given in constructor if not otherwise set
272 >     * getKeepAliveTime returns value given in constructor if not otherwise set
273       */
274      public void testGetKeepAliveTime() {
275          ThreadPoolExecutor p2 = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 353 | Line 353 | public class ThreadPoolExecutorSubclassT
353  
354  
355      /**
356 <     *   getLargestPoolSize increases, but doesn't overestimate, when
357 <     *   multiple threads active
356 >     * getLargestPoolSize increases, but doesn't overestimate, when
357 >     * multiple threads active
358       */
359      public void testGetLargestPoolSize() throws InterruptedException {
360          ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 367 | Line 367 | public class ThreadPoolExecutorSubclassT
367      }
368  
369      /**
370 <     *   getMaximumPoolSize returns value given in constructor if not
371 <     *   otherwise set
370 >     * getMaximumPoolSize returns value given in constructor if not
371 >     * otherwise set
372       */
373      public void testGetMaximumPoolSize() {
374          ThreadPoolExecutor p2 = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 377 | Line 377 | public class ThreadPoolExecutorSubclassT
377      }
378  
379      /**
380 <     *   getPoolSize increases, but doesn't overestimate, when threads
381 <     *   become active
380 >     * getPoolSize increases, but doesn't overestimate, when threads
381 >     * become active
382       */
383      public void testGetPoolSize() {
384          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 389 | Line 389 | public class ThreadPoolExecutorSubclassT
389      }
390  
391      /**
392 <     *  getTaskCount increases, but doesn't overestimate, when tasks submitted
392 >     * getTaskCount increases, but doesn't overestimate, when tasks submitted
393       */
394      public void testGetTaskCount() throws InterruptedException {
395          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 401 | Line 401 | public class ThreadPoolExecutorSubclassT
401      }
402  
403      /**
404 <     *   isShutDown is false before shutdown, true after
404 >     * isShutDown is false before shutdown, true after
405       */
406      public void testIsShutdown() {
407  
# Line 414 | Line 414 | public class ThreadPoolExecutorSubclassT
414  
415  
416      /**
417 <     *  isTerminated is false before termination, true after
417 >     * isTerminated is false before termination, true after
418       */
419      public void testIsTerminated() throws InterruptedException {
420          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 429 | Line 429 | public class ThreadPoolExecutorSubclassT
429      }
430  
431      /**
432 <     *  isTerminating is not true when running or when terminated
432 >     * isTerminating is not true when running or when terminated
433       */
434      public void testIsTerminating() throws InterruptedException {
435          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 498 | Line 498 | public class ThreadPoolExecutorSubclassT
498      }
499  
500      /**
501 <     *   purge removes cancelled tasks from the queue
501 >     * purge removes cancelled tasks from the queue
502       */
503      public void testPurge() {
504          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 516 | Line 516 | public class ThreadPoolExecutorSubclassT
516      }
517  
518      /**
519 <     *  shutDownNow returns a list containing tasks that were not run
519 >     * shutDownNow returns a list containing tasks that were not run
520       */
521      public void testShutDownNow() {
522          ThreadPoolExecutor p1 = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
# Line 529 | Line 529 | public class ThreadPoolExecutorSubclassT
529              try {
530                  l = p1.shutdownNow();
531              } catch (SecurityException ok) { return; }
532
532          }
533          assertTrue(p1.isShutdown());
534          assertTrue(l.size() <= 4);
# Line 828 | Line 827 | public class ThreadPoolExecutorSubclassT
827  
828  
829      /**
830 <     *  execute throws RejectedExecutionException
832 <     *  if saturated.
830 >     * execute throws RejectedExecutionException if saturated.
831       */
832      public void testSaturatedExecute() {
833          ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1));
# Line 844 | Line 842 | public class ThreadPoolExecutorSubclassT
842      }
843  
844      /**
845 <     *  executor using CallerRunsPolicy runs task if saturated.
845 >     * executor using CallerRunsPolicy runs task if saturated.
846       */
847      public void testSaturatedExecute2() {
848          RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy();
# Line 870 | Line 868 | public class ThreadPoolExecutorSubclassT
868      }
869  
870      /**
871 <     *  executor using DiscardPolicy drops task if saturated.
871 >     * executor using DiscardPolicy drops task if saturated.
872       */
873      public void testSaturatedExecute3() {
874          RejectedExecutionHandler h = new CustomTPE.DiscardPolicy();
# Line 895 | Line 893 | public class ThreadPoolExecutorSubclassT
893      }
894  
895      /**
896 <     *  executor using DiscardOldestPolicy drops oldest task if saturated.
896 >     * executor using DiscardOldestPolicy drops oldest task if saturated.
897       */
898      public void testSaturatedExecute4() {
899          RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy();
# Line 916 | Line 914 | public class ThreadPoolExecutorSubclassT
914      }
915  
916      /**
917 <     *  execute throws RejectedExecutionException if shutdown
917 >     * execute throws RejectedExecutionException if shutdown
918       */
919      public void testRejectedExecutionExceptionOnShutdown() {
920          ThreadPoolExecutor tpe =
# Line 931 | Line 929 | public class ThreadPoolExecutorSubclassT
929      }
930  
931      /**
932 <     *  execute using CallerRunsPolicy drops task on shutdown
932 >     * execute using CallerRunsPolicy drops task on shutdown
933       */
934      public void testCallerRunsOnShutdown() {
935          RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy();
# Line 948 | Line 946 | public class ThreadPoolExecutorSubclassT
946      }
947  
948      /**
949 <     *  execute using DiscardPolicy drops task on shutdown
949 >     * execute using DiscardPolicy drops task on shutdown
950       */
951      public void testDiscardOnShutdown() {
952          RejectedExecutionHandler h = new CustomTPE.DiscardPolicy();
# Line 966 | Line 964 | public class ThreadPoolExecutorSubclassT
964  
965  
966      /**
967 <     *  execute using DiscardOldestPolicy drops task on shutdown
967 >     * execute using DiscardOldestPolicy drops task on shutdown
968       */
969      public void testDiscardOldestOnShutdown() {
970          RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy();
# Line 984 | Line 982 | public class ThreadPoolExecutorSubclassT
982  
983  
984      /**
985 <     *  execute (null) throws NPE
985 >     * execute(null) throws NPE
986       */
987      public void testExecuteNull() {
988          ThreadPoolExecutor tpe = null;
# Line 998 | Line 996 | public class ThreadPoolExecutorSubclassT
996      }
997  
998      /**
999 <     *  setCorePoolSize of negative value throws IllegalArgumentException
999 >     * setCorePoolSize of negative value throws IllegalArgumentException
1000       */
1001      public void testCorePoolSizeIllegalArgumentException() {
1002          ThreadPoolExecutor tpe =
# Line 1014 | Line 1012 | public class ThreadPoolExecutorSubclassT
1012      }
1013  
1014      /**
1015 <     *  setMaximumPoolSize(int) throws IllegalArgumentException if
1016 <     *  given a value less the core pool size
1015 >     * setMaximumPoolSize(int) throws IllegalArgumentException
1016 >     * if given a value less the core pool size
1017       */
1018      public void testMaximumPoolSizeIllegalArgumentException() {
1019          ThreadPoolExecutor tpe =
# Line 1031 | Line 1029 | public class ThreadPoolExecutorSubclassT
1029      }
1030  
1031      /**
1032 <     *  setMaximumPoolSize throws IllegalArgumentException
1033 <     *  if given a negative value
1032 >     * setMaximumPoolSize throws IllegalArgumentException
1033 >     * if given a negative value
1034       */
1035      public void testMaximumPoolSizeIllegalArgumentException2() {
1036          ThreadPoolExecutor tpe =
# Line 1049 | Line 1047 | public class ThreadPoolExecutorSubclassT
1047  
1048  
1049      /**
1050 <     *  setKeepAliveTime  throws IllegalArgumentException
1051 <     *  when given a negative value
1050 >     * setKeepAliveTime throws IllegalArgumentException
1051 >     * when given a negative value
1052       */
1053      public void testKeepAliveTimeIllegalArgumentException() {
1054          ThreadPoolExecutor tpe =
# Line 1169 | Line 1167 | public class ThreadPoolExecutorSubclassT
1167       * invokeAny(c) throws NPE if c has null elements
1168       */
1169      public void testInvokeAny3() throws Exception {
1170 <        final CountDownLatch latch = new CountDownLatch(1);
1170 >        CountDownLatch latch = new CountDownLatch(1);
1171          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1172 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1173 +        l.add(latchAwaitingStringTask(latch));
1174 +        l.add(null);
1175          try {
1175            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1176            l.add(new Callable<String>() {
1177                      public String call() {
1178                          try {
1179                              latch.await();
1180                          } catch (InterruptedException ok) {}
1181                          return TEST_STRING;
1182                      }});
1183            l.add(null);
1176              e.invokeAny(l);
1177              shouldThrow();
1178          } catch (NullPointerException success) {
# Line 1195 | Line 1187 | public class ThreadPoolExecutorSubclassT
1187       */
1188      public void testInvokeAny4() throws Exception {
1189          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1190 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1191 +        l.add(new NPETask());
1192          try {
1199            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1200            l.add(new NPETask());
1193              e.invokeAny(l);
1194              shouldThrow();
1195          } catch (ExecutionException success) {
1196 +            assertTrue(success.getCause() instanceof NullPointerException);
1197          } finally {
1198              joinPool(e);
1199          }
# Line 1212 | Line 1205 | public class ThreadPoolExecutorSubclassT
1205      public void testInvokeAny5() throws Exception {
1206          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1207          try {
1208 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1208 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1209              l.add(new StringTask());
1210              l.add(new StringTask());
1211              String result = e.invokeAny(l);
# Line 1254 | Line 1247 | public class ThreadPoolExecutorSubclassT
1247       */
1248      public void testInvokeAll3() throws Exception {
1249          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1250 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1251 +        l.add(new StringTask());
1252 +        l.add(null);
1253          try {
1258            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1259            l.add(new StringTask());
1260            l.add(null);
1254              e.invokeAll(l);
1255              shouldThrow();
1256          } catch (NullPointerException success) {
# Line 1271 | Line 1264 | public class ThreadPoolExecutorSubclassT
1264       */
1265      public void testInvokeAll4() throws Exception {
1266          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1267 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1268 +        l.add(new NPETask());
1269 +        List<Future<String>> futures = e.invokeAll(l);
1270 +        assertEquals(1, futures.size());
1271          try {
1272 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1276 <            l.add(new NPETask());
1277 <            List<Future<String>> result = e.invokeAll(l);
1278 <            assertEquals(1, result.size());
1279 <            for (Future<String> future : result)
1280 <                future.get();
1272 >            futures.get(0).get();
1273              shouldThrow();
1274          } catch (ExecutionException success) {
1275 +            assertTrue(success.getCause() instanceof NullPointerException);
1276          } finally {
1277              joinPool(e);
1278          }
# Line 1291 | Line 1284 | public class ThreadPoolExecutorSubclassT
1284      public void testInvokeAll5() throws Exception {
1285          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1286          try {
1287 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1287 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1288              l.add(new StringTask());
1289              l.add(new StringTask());
1290 <            List<Future<String>> result = e.invokeAll(l);
1291 <            assertEquals(2, result.size());
1292 <            for (Future<String> future : result)
1290 >            List<Future<String>> futures = e.invokeAll(l);
1291 >            assertEquals(2, futures.size());
1292 >            for (Future<String> future : futures)
1293                  assertSame(TEST_STRING, future.get());
1294          } finally {
1295              joinPool(e);
# Line 1324 | Line 1317 | public class ThreadPoolExecutorSubclassT
1317       */
1318      public void testTimedInvokeAnyNullTimeUnit() throws Exception {
1319          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1320 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1321 +        l.add(new StringTask());
1322          try {
1328            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1329            l.add(new StringTask());
1323              e.invokeAny(l, MEDIUM_DELAY_MS, null);
1324              shouldThrow();
1325          } catch (NullPointerException success) {
# Line 1353 | Line 1346 | public class ThreadPoolExecutorSubclassT
1346       * timed invokeAny(c) throws NPE if c has null elements
1347       */
1348      public void testTimedInvokeAny3() throws Exception {
1349 <        final CountDownLatch latch = new CountDownLatch(1);
1349 >        CountDownLatch latch = new CountDownLatch(1);
1350          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1351 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1352 +        l.add(latchAwaitingStringTask(latch));
1353 +        l.add(null);
1354          try {
1359            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1360            l.add(new Callable<String>() {
1361                      public String call() {
1362                          try {
1363                              latch.await();
1364                          } catch (InterruptedException ok) {}
1365                          return TEST_STRING;
1366                      }});
1367            l.add(null);
1355              e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1356              shouldThrow();
1357          } catch (NullPointerException success) {
# Line 1379 | Line 1366 | public class ThreadPoolExecutorSubclassT
1366       */
1367      public void testTimedInvokeAny4() throws Exception {
1368          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1369 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1370 +        l.add(new NPETask());
1371          try {
1383            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1384            l.add(new NPETask());
1372              e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
1373              shouldThrow();
1374          } catch (ExecutionException success) {
1375 +            assertTrue(success.getCause() instanceof NullPointerException);
1376          } finally {
1377              joinPool(e);
1378          }
# Line 1396 | Line 1384 | public class ThreadPoolExecutorSubclassT
1384      public void testTimedInvokeAny5() throws Exception {
1385          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1386          try {
1387 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1387 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1388              l.add(new StringTask());
1389              l.add(new StringTask());
1390              String result = e.invokeAny(l, MEDIUM_DELAY_MS, MILLISECONDS);
# Line 1425 | Line 1413 | public class ThreadPoolExecutorSubclassT
1413       */
1414      public void testTimedInvokeAllNullTimeUnit() throws Exception {
1415          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1416 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1417 +        l.add(new StringTask());
1418          try {
1429            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1430            l.add(new StringTask());
1419              e.invokeAll(l, MEDIUM_DELAY_MS, null);
1420              shouldThrow();
1421          } catch (NullPointerException success) {
# Line 1454 | Line 1442 | public class ThreadPoolExecutorSubclassT
1442       */
1443      public void testTimedInvokeAll3() throws Exception {
1444          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1445 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1446 +        l.add(new StringTask());
1447 +        l.add(null);
1448          try {
1458            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1459            l.add(new StringTask());
1460            l.add(null);
1449              e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1450              shouldThrow();
1451          } catch (NullPointerException success) {
# Line 1471 | Line 1459 | public class ThreadPoolExecutorSubclassT
1459       */
1460      public void testTimedInvokeAll4() throws Exception {
1461          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1462 +        List<Callable<String>> l = new ArrayList<Callable<String>>();
1463 +        l.add(new NPETask());
1464 +        List<Future<String>> futures =
1465 +            e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1466 +        assertEquals(1, futures.size());
1467          try {
1468 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1476 <            l.add(new NPETask());
1477 <            List<Future<String>> result = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1478 <            assertEquals(1, result.size());
1479 <            for (Future<String> future : result)
1480 <                future.get();
1468 >            futures.get(0).get();
1469              shouldThrow();
1470          } catch (ExecutionException success) {
1471              assertTrue(success.getCause() instanceof NullPointerException);
# Line 1492 | Line 1480 | public class ThreadPoolExecutorSubclassT
1480      public void testTimedInvokeAll5() throws Exception {
1481          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1482          try {
1483 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1483 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1484              l.add(new StringTask());
1485              l.add(new StringTask());
1486 <            List<Future<String>> result = e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1487 <            assertEquals(2, result.size());
1488 <            for (Future<String> future : result)
1486 >            List<Future<String>> futures =
1487 >                e.invokeAll(l, MEDIUM_DELAY_MS, MILLISECONDS);
1488 >            assertEquals(2, futures.size());
1489 >            for (Future<String> future : futures)
1490                  assertSame(TEST_STRING, future.get());
1502        } catch (ExecutionException success) {
1491          } finally {
1492              joinPool(e);
1493          }
# Line 1511 | Line 1499 | public class ThreadPoolExecutorSubclassT
1499      public void testTimedInvokeAll6() throws Exception {
1500          ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1501          try {
1502 <            ArrayList<Callable<String>> l = new ArrayList<Callable<String>>();
1502 >            List<Callable<String>> l = new ArrayList<Callable<String>>();
1503              l.add(new StringTask());
1504              l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING));
1505              l.add(new StringTask());
1506 <            List<Future<String>> result = e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS);
1507 <            assertEquals(3, result.size());
1508 <            Iterator<Future<String>> it = result.iterator();
1506 >            List<Future<String>> futures =
1507 >                e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS);
1508 >            assertEquals(3, futures.size());
1509 >            Iterator<Future<String>> it = futures.iterator();
1510              Future<String> f1 = it.next();
1511              Future<String> f2 = it.next();
1512              Future<String> f3 = it.next();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines