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.76 by jsr166, Sun Oct 4 03:49:33 2015 UTC vs.
Revision 1.81 by jsr166, Sun Oct 4 06:45:29 2015 UTC

# Line 272 | Line 272 | public class ThreadPoolExecutorSubclassT
272       * prestartCoreThread starts a thread if under corePoolSize, else doesn't
273       */
274      public void testPrestartCoreThread() {
275 <        ThreadPoolExecutor p =
275 >        final ThreadPoolExecutor p =
276              new CustomTPE(2, 6,
277                            LONG_DELAY_MS, MILLISECONDS,
278                            new ArrayBlockingQueue<Runnable>(10));
# Line 298 | Line 298 | public class ThreadPoolExecutorSubclassT
298       * prestartAllCoreThreads starts all corePoolSize threads
299       */
300      public void testPrestartAllCoreThreads() {
301 <        ThreadPoolExecutor p =
301 >        final ThreadPoolExecutor p =
302              new CustomTPE(2, 6,
303                            LONG_DELAY_MS, MILLISECONDS,
304                            new ArrayBlockingQueue<Runnable>(10));
# Line 752 | Line 752 | public class ThreadPoolExecutorSubclassT
752          final int poolSize = 2;
753          final int count = 5;
754          final AtomicInteger ran = new AtomicInteger(0);
755 <        ThreadPoolExecutor p =
756 <            new CustomTPE(poolSize, poolSize, LONG_DELAY_MS, MILLISECONDS,
755 >        final ThreadPoolExecutor p =
756 >            new CustomTPE(poolSize, poolSize,
757 >                          LONG_DELAY_MS, MILLISECONDS,
758                            new ArrayBlockingQueue<Runnable>(10));
759          CountDownLatch threadsStarted = new CountDownLatch(poolSize);
760          Runnable waiter = new CheckedRunnable() { public void realRun() {
# Line 1236 | Line 1237 | public class ThreadPoolExecutorSubclassT
1237       * execute throws RejectedExecutionException if shutdown
1238       */
1239      public void testRejectedExecutionExceptionOnShutdown() {
1240 <        ThreadPoolExecutor p =
1241 <            new CustomTPE(1,1,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(1));
1240 >        final ThreadPoolExecutor p =
1241 >            new CustomTPE(1, 1,
1242 >                          LONG_DELAY_MS, MILLISECONDS,
1243 >                          new ArrayBlockingQueue<Runnable>(1));
1244          try { p.shutdown(); } catch (SecurityException ok) { return; }
1245 <        try {
1246 <            p.execute(new NoOpRunnable());
1247 <            shouldThrow();
1248 <        } catch (RejectedExecutionException success) {}
1249 <
1250 <        joinPool(p);
1245 >        try (PoolCleaner cleaner = cleaner(p)) {
1246 >            try {
1247 >                p.execute(new NoOpRunnable());
1248 >                shouldThrow();
1249 >            } catch (RejectedExecutionException success) {}
1250 >        }
1251      }
1252  
1253      /**
1254       * execute using CallerRunsPolicy drops task on shutdown
1255       */
1256      public void testCallerRunsOnShutdown() {
1257 <        RejectedExecutionHandler h = new CustomTPE.CallerRunsPolicy();
1258 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
1259 <
1257 >        final ThreadPoolExecutor p =
1258 >            new CustomTPE(1, 1,
1259 >                          LONG_DELAY_MS, MILLISECONDS,
1260 >                          new ArrayBlockingQueue<Runnable>(1),
1261 >                          new CustomTPE.CallerRunsPolicy());
1262          try { p.shutdown(); } catch (SecurityException ok) { return; }
1263 <        try {
1263 >        try (PoolCleaner cleaner = cleaner(p)) {
1264              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
1265              p.execute(r);
1266              assertFalse(r.done);
1262        } finally {
1263            joinPool(p);
1267          }
1268      }
1269  
# Line 1268 | Line 1271 | public class ThreadPoolExecutorSubclassT
1271       * execute using DiscardPolicy drops task on shutdown
1272       */
1273      public void testDiscardOnShutdown() {
1274 <        RejectedExecutionHandler h = new CustomTPE.DiscardPolicy();
1275 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
1276 <
1274 >        final ThreadPoolExecutor p =
1275 >            new CustomTPE(1, 1,
1276 >                          LONG_DELAY_MS, MILLISECONDS,
1277 >                          new ArrayBlockingQueue<Runnable>(1),
1278 >                          new CustomTPE.DiscardPolicy());
1279          try { p.shutdown(); } catch (SecurityException ok) { return; }
1280 <        try {
1280 >        try (PoolCleaner cleaner = cleaner(p)) {
1281              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
1282              p.execute(r);
1283              assertFalse(r.done);
1279        } finally {
1280            joinPool(p);
1284          }
1285      }
1286  
# Line 1285 | Line 1288 | public class ThreadPoolExecutorSubclassT
1288       * execute using DiscardOldestPolicy drops task on shutdown
1289       */
1290      public void testDiscardOldestOnShutdown() {
1291 <        RejectedExecutionHandler h = new CustomTPE.DiscardOldestPolicy();
1292 <        ThreadPoolExecutor p = new CustomTPE(1,1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(1), h);
1291 >        final ThreadPoolExecutor p =
1292 >            new CustomTPE(1, 1,
1293 >                          LONG_DELAY_MS, MILLISECONDS,
1294 >                          new ArrayBlockingQueue<Runnable>(1),
1295 >                          new CustomTPE.DiscardOldestPolicy());
1296  
1297          try { p.shutdown(); } catch (SecurityException ok) { return; }
1298 <        try {
1298 >        try (PoolCleaner cleaner = cleaner(p)) {
1299              TrackedNoOpRunnable r = new TrackedNoOpRunnable();
1300              p.execute(r);
1301              assertFalse(r.done);
1296        } finally {
1297            joinPool(p);
1302          }
1303      }
1304  
# Line 1302 | Line 1306 | public class ThreadPoolExecutorSubclassT
1306       * execute(null) throws NPE
1307       */
1308      public void testExecuteNull() {
1309 <        ThreadPoolExecutor p =
1310 <            new CustomTPE(1, 2, 1L, SECONDS,
1309 >        final ThreadPoolExecutor p =
1310 >            new CustomTPE(1, 2,
1311 >                          1L, SECONDS,
1312                            new ArrayBlockingQueue<Runnable>(10));
1313 <        try {
1314 <            p.execute(null);
1315 <            shouldThrow();
1316 <        } catch (NullPointerException success) {}
1317 <
1318 <        joinPool(p);
1313 >        try (PoolCleaner cleaner = cleaner(p)) {
1314 >            try {
1315 >                p.execute(null);
1316 >                shouldThrow();
1317 >            } catch (NullPointerException success) {}
1318 >        }
1319      }
1320  
1321      /**
1322       * setCorePoolSize of negative value throws IllegalArgumentException
1323       */
1324      public void testCorePoolSizeIllegalArgumentException() {
1325 <        ThreadPoolExecutor p =
1326 <            new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1327 <        try {
1328 <            p.setCorePoolSize(-1);
1329 <            shouldThrow();
1330 <        } catch (IllegalArgumentException success) {
1331 <        } finally {
1332 <            try { p.shutdown(); } catch (SecurityException ok) { return; }
1325 >        final ThreadPoolExecutor p =
1326 >            new CustomTPE(1, 2,
1327 >                          LONG_DELAY_MS, MILLISECONDS,
1328 >                          new ArrayBlockingQueue<Runnable>(10));
1329 >        try (PoolCleaner cleaner = cleaner(p)) {
1330 >            try {
1331 >                p.setCorePoolSize(-1);
1332 >                shouldThrow();
1333 >            } catch (IllegalArgumentException success) {}
1334          }
1329        joinPool(p);
1335      }
1336  
1337      /**
# Line 1334 | Line 1339 | public class ThreadPoolExecutorSubclassT
1339       * if given a value less the core pool size
1340       */
1341      public void testMaximumPoolSizeIllegalArgumentException() {
1342 <        ThreadPoolExecutor p =
1343 <            new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1342 >        final ThreadPoolExecutor p =
1343 >            new CustomTPE(2, 3,
1344 >                          LONG_DELAY_MS, MILLISECONDS,
1345 >                          new ArrayBlockingQueue<Runnable>(10));
1346          try {
1347              p.setMaximumPoolSize(1);
1348              shouldThrow();
# Line 1351 | Line 1358 | public class ThreadPoolExecutorSubclassT
1358       * if given a negative value
1359       */
1360      public void testMaximumPoolSizeIllegalArgumentException2() {
1361 <        ThreadPoolExecutor p =
1362 <            new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1361 >        final ThreadPoolExecutor p =
1362 >            new CustomTPE(2, 3,
1363 >                          LONG_DELAY_MS,
1364 >                          MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1365          try {
1366              p.setMaximumPoolSize(-1);
1367              shouldThrow();
# Line 1368 | Line 1377 | public class ThreadPoolExecutorSubclassT
1377       * when given a negative value
1378       */
1379      public void testKeepAliveTimeIllegalArgumentException() {
1380 <        ThreadPoolExecutor p =
1381 <            new CustomTPE(2,3,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10));
1380 >        final ThreadPoolExecutor p =
1381 >            new CustomTPE(2, 3,
1382 >                          LONG_DELAY_MS, MILLISECONDS,
1383 >                          new ArrayBlockingQueue<Runnable>(10));
1384  
1385          try {
1386              p.setKeepAliveTime(-1,MILLISECONDS);
# Line 1416 | Line 1427 | public class ThreadPoolExecutorSubclassT
1427       * completed submit of callable returns result
1428       */
1429      public void testSubmitCallable() throws Exception {
1430 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1430 >        final ExecutorService e =
1431 >            new CustomTPE(2, 2,
1432 >                          LONG_DELAY_MS, MILLISECONDS,
1433 >                          new ArrayBlockingQueue<Runnable>(10));
1434          try {
1435              Future<String> future = e.submit(new StringTask());
1436              String result = future.get();
# Line 1430 | Line 1444 | public class ThreadPoolExecutorSubclassT
1444       * completed submit of runnable returns successfully
1445       */
1446      public void testSubmitRunnable() throws Exception {
1447 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1447 >        final ExecutorService e =
1448 >            new CustomTPE(2, 2,
1449 >                          LONG_DELAY_MS, MILLISECONDS,
1450 >                          new ArrayBlockingQueue<Runnable>(10));
1451          try {
1452              Future<?> future = e.submit(new NoOpRunnable());
1453              future.get();
# Line 1444 | Line 1461 | public class ThreadPoolExecutorSubclassT
1461       * completed submit of (runnable, result) returns result
1462       */
1463      public void testSubmitRunnable2() throws Exception {
1464 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1464 >        final ExecutorService e =
1465 >            new CustomTPE(2, 2,
1466 >                          LONG_DELAY_MS, MILLISECONDS,
1467 >                          new ArrayBlockingQueue<Runnable>(10));
1468          try {
1469              Future<String> future = e.submit(new NoOpRunnable(), TEST_STRING);
1470              String result = future.get();
# Line 1458 | Line 1478 | public class ThreadPoolExecutorSubclassT
1478       * invokeAny(null) throws NPE
1479       */
1480      public void testInvokeAny1() throws Exception {
1481 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1481 >        final ExecutorService e =
1482 >            new CustomTPE(2, 2,
1483 >                          LONG_DELAY_MS, MILLISECONDS,
1484 >                          new ArrayBlockingQueue<Runnable>(10));
1485          try {
1486              e.invokeAny(null);
1487              shouldThrow();
# Line 1472 | Line 1495 | public class ThreadPoolExecutorSubclassT
1495       * invokeAny(empty collection) throws IAE
1496       */
1497      public void testInvokeAny2() throws Exception {
1498 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1498 >        final ExecutorService e =
1499 >            new CustomTPE(2, 2,
1500 >                          LONG_DELAY_MS, MILLISECONDS,
1501 >                          new ArrayBlockingQueue<Runnable>(10));
1502          try {
1503              e.invokeAny(new ArrayList<Callable<String>>());
1504              shouldThrow();
# Line 1487 | Line 1513 | public class ThreadPoolExecutorSubclassT
1513       */
1514      public void testInvokeAny3() throws Exception {
1515          CountDownLatch latch = new CountDownLatch(1);
1516 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1516 >        final ExecutorService e =
1517 >            new CustomTPE(2, 2,
1518 >                          LONG_DELAY_MS, MILLISECONDS,
1519 >                          new ArrayBlockingQueue<Runnable>(10));
1520          List<Callable<String>> l = new ArrayList<Callable<String>>();
1521          l.add(latchAwaitingStringTask(latch));
1522          l.add(null);
# Line 1505 | Line 1534 | public class ThreadPoolExecutorSubclassT
1534       * invokeAny(c) throws ExecutionException if no task completes
1535       */
1536      public void testInvokeAny4() throws Exception {
1537 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1537 >        final ExecutorService e =
1538 >            new CustomTPE(2, 2,
1539 >                          LONG_DELAY_MS, MILLISECONDS,
1540 >                          new ArrayBlockingQueue<Runnable>(10));
1541          List<Callable<String>> l = new ArrayList<Callable<String>>();
1542          l.add(new NPETask());
1543          try {
# Line 1522 | Line 1554 | public class ThreadPoolExecutorSubclassT
1554       * invokeAny(c) returns result of some task
1555       */
1556      public void testInvokeAny5() throws Exception {
1557 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1557 >        final ExecutorService e =
1558 >            new CustomTPE(2, 2,
1559 >                          LONG_DELAY_MS, MILLISECONDS,
1560 >                          new ArrayBlockingQueue<Runnable>(10));
1561          try {
1562              List<Callable<String>> l = new ArrayList<Callable<String>>();
1563              l.add(new StringTask());
# Line 1538 | Line 1573 | public class ThreadPoolExecutorSubclassT
1573       * invokeAll(null) throws NPE
1574       */
1575      public void testInvokeAll1() throws Exception {
1576 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1576 >        final ExecutorService e =
1577 >            new CustomTPE(2, 2,
1578 >                          LONG_DELAY_MS, MILLISECONDS,
1579 >                          new ArrayBlockingQueue<Runnable>(10));
1580          try {
1581              e.invokeAll(null);
1582              shouldThrow();
# Line 1552 | Line 1590 | public class ThreadPoolExecutorSubclassT
1590       * invokeAll(empty collection) returns empty collection
1591       */
1592      public void testInvokeAll2() throws Exception {
1593 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1593 >        final ExecutorService e =
1594 >            new CustomTPE(2, 2,
1595 >                          LONG_DELAY_MS, MILLISECONDS,
1596 >                          new ArrayBlockingQueue<Runnable>(10));
1597          try {
1598              List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>());
1599              assertTrue(r.isEmpty());
# Line 1565 | Line 1606 | public class ThreadPoolExecutorSubclassT
1606       * invokeAll(c) throws NPE if c has null elements
1607       */
1608      public void testInvokeAll3() throws Exception {
1609 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1609 >        final ExecutorService e =
1610 >            new CustomTPE(2, 2,
1611 >                          LONG_DELAY_MS, MILLISECONDS,
1612 >                          new ArrayBlockingQueue<Runnable>(10));
1613          List<Callable<String>> l = new ArrayList<Callable<String>>();
1614          l.add(new StringTask());
1615          l.add(null);
# Line 1582 | Line 1626 | public class ThreadPoolExecutorSubclassT
1626       * get of element of invokeAll(c) throws exception on failed task
1627       */
1628      public void testInvokeAll4() throws Exception {
1629 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1629 >        final ExecutorService e =
1630 >            new CustomTPE(2, 2,
1631 >                          LONG_DELAY_MS, MILLISECONDS,
1632 >                          new ArrayBlockingQueue<Runnable>(10));
1633          List<Callable<String>> l = new ArrayList<Callable<String>>();
1634          l.add(new NPETask());
1635          List<Future<String>> futures = e.invokeAll(l);
# Line 1601 | Line 1648 | public class ThreadPoolExecutorSubclassT
1648       * invokeAll(c) returns results of all completed tasks
1649       */
1650      public void testInvokeAll5() throws Exception {
1651 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1651 >        final ExecutorService e =
1652 >            new CustomTPE(2, 2,
1653 >                          LONG_DELAY_MS, MILLISECONDS,
1654 >                          new ArrayBlockingQueue<Runnable>(10));
1655          try {
1656              List<Callable<String>> l = new ArrayList<Callable<String>>();
1657              l.add(new StringTask());
# Line 1619 | Line 1669 | public class ThreadPoolExecutorSubclassT
1669       * timed invokeAny(null) throws NPE
1670       */
1671      public void testTimedInvokeAny1() throws Exception {
1672 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1672 >        final ExecutorService e =
1673 >            new CustomTPE(2, 2,
1674 >                          LONG_DELAY_MS, MILLISECONDS,
1675 >                          new ArrayBlockingQueue<Runnable>(10));
1676          try {
1677              e.invokeAny(null, MEDIUM_DELAY_MS, MILLISECONDS);
1678              shouldThrow();
# Line 1633 | Line 1686 | public class ThreadPoolExecutorSubclassT
1686       * timed invokeAny(,,null) throws NPE
1687       */
1688      public void testTimedInvokeAnyNullTimeUnit() throws Exception {
1689 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1689 >        final ExecutorService e =
1690 >            new CustomTPE(2, 2,
1691 >                          LONG_DELAY_MS, MILLISECONDS,
1692 >                          new ArrayBlockingQueue<Runnable>(10));
1693          List<Callable<String>> l = new ArrayList<Callable<String>>();
1694          l.add(new StringTask());
1695          try {
# Line 1649 | Line 1705 | public class ThreadPoolExecutorSubclassT
1705       * timed invokeAny(empty collection) throws IAE
1706       */
1707      public void testTimedInvokeAny2() throws Exception {
1708 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1708 >        final ExecutorService e =
1709 >            new CustomTPE(2, 2,
1710 >                          LONG_DELAY_MS, MILLISECONDS,
1711 >                          new ArrayBlockingQueue<Runnable>(10));
1712          try {
1713              e.invokeAny(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, MILLISECONDS);
1714              shouldThrow();
# Line 1664 | Line 1723 | public class ThreadPoolExecutorSubclassT
1723       */
1724      public void testTimedInvokeAny3() throws Exception {
1725          CountDownLatch latch = new CountDownLatch(1);
1726 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1726 >        final ExecutorService e =
1727 >            new CustomTPE(2, 2,
1728 >                          LONG_DELAY_MS, MILLISECONDS,
1729 >                          new ArrayBlockingQueue<Runnable>(10));
1730          List<Callable<String>> l = new ArrayList<Callable<String>>();
1731          l.add(latchAwaitingStringTask(latch));
1732          l.add(null);
# Line 1682 | Line 1744 | public class ThreadPoolExecutorSubclassT
1744       * timed invokeAny(c) throws ExecutionException if no task completes
1745       */
1746      public void testTimedInvokeAny4() throws Exception {
1747 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1747 >        final ExecutorService e =
1748 >            new CustomTPE(2, 2,
1749 >                          LONG_DELAY_MS, MILLISECONDS,
1750 >                          new ArrayBlockingQueue<Runnable>(10));
1751          List<Callable<String>> l = new ArrayList<Callable<String>>();
1752          l.add(new NPETask());
1753          try {
# Line 1699 | Line 1764 | public class ThreadPoolExecutorSubclassT
1764       * timed invokeAny(c) returns result of some task
1765       */
1766      public void testTimedInvokeAny5() throws Exception {
1767 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1767 >        final ExecutorService e =
1768 >            new CustomTPE(2, 2,
1769 >                          LONG_DELAY_MS, MILLISECONDS,
1770 >                          new ArrayBlockingQueue<Runnable>(10));
1771          try {
1772              List<Callable<String>> l = new ArrayList<Callable<String>>();
1773              l.add(new StringTask());
# Line 1715 | Line 1783 | public class ThreadPoolExecutorSubclassT
1783       * timed invokeAll(null) throws NPE
1784       */
1785      public void testTimedInvokeAll1() throws Exception {
1786 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1786 >        final ExecutorService e =
1787 >            new CustomTPE(2, 2,
1788 >                          LONG_DELAY_MS, MILLISECONDS,
1789 >                          new ArrayBlockingQueue<Runnable>(10));
1790          try {
1791              e.invokeAll(null, MEDIUM_DELAY_MS, MILLISECONDS);
1792              shouldThrow();
# Line 1729 | Line 1800 | public class ThreadPoolExecutorSubclassT
1800       * timed invokeAll(,,null) throws NPE
1801       */
1802      public void testTimedInvokeAllNullTimeUnit() throws Exception {
1803 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1803 >        final ExecutorService e =
1804 >            new CustomTPE(2, 2,
1805 >                          LONG_DELAY_MS, MILLISECONDS,
1806 >                          new ArrayBlockingQueue<Runnable>(10));
1807          List<Callable<String>> l = new ArrayList<Callable<String>>();
1808          l.add(new StringTask());
1809          try {
# Line 1745 | Line 1819 | public class ThreadPoolExecutorSubclassT
1819       * timed invokeAll(empty collection) returns empty collection
1820       */
1821      public void testTimedInvokeAll2() throws Exception {
1822 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1822 >        final ExecutorService e =
1823 >            new CustomTPE(2, 2,
1824 >                          LONG_DELAY_MS, MILLISECONDS,
1825 >                          new ArrayBlockingQueue<Runnable>(10));
1826          try {
1827              List<Future<String>> r = e.invokeAll(new ArrayList<Callable<String>>(), MEDIUM_DELAY_MS, MILLISECONDS);
1828              assertTrue(r.isEmpty());
# Line 1758 | Line 1835 | public class ThreadPoolExecutorSubclassT
1835       * timed invokeAll(c) throws NPE if c has null elements
1836       */
1837      public void testTimedInvokeAll3() throws Exception {
1838 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1838 >        final ExecutorService e =
1839 >            new CustomTPE(2, 2,
1840 >                          LONG_DELAY_MS, MILLISECONDS,
1841 >                          new ArrayBlockingQueue<Runnable>(10));
1842          List<Callable<String>> l = new ArrayList<Callable<String>>();
1843          l.add(new StringTask());
1844          l.add(null);
# Line 1775 | Line 1855 | public class ThreadPoolExecutorSubclassT
1855       * get of element of invokeAll(c) throws exception on failed task
1856       */
1857      public void testTimedInvokeAll4() throws Exception {
1858 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1858 >        final ExecutorService e =
1859 >            new CustomTPE(2, 2,
1860 >                          LONG_DELAY_MS, MILLISECONDS,
1861 >                          new ArrayBlockingQueue<Runnable>(10));
1862          List<Callable<String>> l = new ArrayList<Callable<String>>();
1863          l.add(new NPETask());
1864          List<Future<String>> futures =
# Line 1795 | Line 1878 | public class ThreadPoolExecutorSubclassT
1878       * timed invokeAll(c) returns results of all completed tasks
1879       */
1880      public void testTimedInvokeAll5() throws Exception {
1881 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1881 >        final ExecutorService e =
1882 >            new CustomTPE(2, 2,
1883 >                          LONG_DELAY_MS, MILLISECONDS,
1884 >                          new ArrayBlockingQueue<Runnable>(10));
1885          try {
1886              List<Callable<String>> l = new ArrayList<Callable<String>>();
1887              l.add(new StringTask());
# Line 1814 | Line 1900 | public class ThreadPoolExecutorSubclassT
1900       * timed invokeAll(c) cancels tasks not completed by timeout
1901       */
1902      public void testTimedInvokeAll6() throws Exception {
1903 <        ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1903 >        final ExecutorService e =
1904 >            new CustomTPE(2, 2,
1905 >                          LONG_DELAY_MS, MILLISECONDS,
1906 >                          new ArrayBlockingQueue<Runnable>(10));
1907          try {
1908              for (long timeout = timeoutMillis();;) {
1909                  List<Callable<String>> tasks = new ArrayList<>();
# Line 1872 | Line 1961 | public class ThreadPoolExecutorSubclassT
1961       * allowsCoreThreadTimeOut is by default false.
1962       */
1963      public void testAllowsCoreThreadTimeOut() {
1964 <        ThreadPoolExecutor p = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10));
1964 >        final ThreadPoolExecutor p =
1965 >            new CustomTPE(2, 2,
1966 >                          1000, MILLISECONDS,
1967 >                          new ArrayBlockingQueue<Runnable>(10));
1968          assertFalse(p.allowsCoreThreadTimeOut());
1969          joinPool(p);
1970      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines