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.96 by jsr166, Wed Aug 24 22:22:39 2016 UTC vs.
Revision 1.97 by jsr166, Wed Jan 4 06:09:58 2017 UTC

# Line 651 | Line 651 | public class ThreadPoolExecutorSubclassT
651       */
652      public void testGetQueue() throws InterruptedException {
653          final CountDownLatch done = new CountDownLatch(1);
654 <        final BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10);
654 >        final BlockingQueue<Runnable> q = new ArrayBlockingQueue<>(10);
655          final ThreadPoolExecutor p =
656              new CustomTPE(1, 1,
657                            LONG_DELAY_MS, MILLISECONDS,
# Line 660 | Line 660 | public class ThreadPoolExecutorSubclassT
660              final CountDownLatch threadStarted = new CountDownLatch(1);
661              FutureTask[] tasks = new FutureTask[5];
662              for (int i = 0; i < tasks.length; i++) {
663 <                Callable task = new CheckedCallable<Boolean>() {
663 >                Callable<Boolean> task = new CheckedCallable<Boolean>() {
664                      public Boolean realCall() throws InterruptedException {
665                          threadStarted.countDown();
666                          assertSame(q, p.getQueue());
# Line 683 | Line 683 | public class ThreadPoolExecutorSubclassT
683       */
684      public void testRemove() throws InterruptedException {
685          final CountDownLatch done = new CountDownLatch(1);
686 <        BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10);
686 >        BlockingQueue<Runnable> q = new ArrayBlockingQueue<>(10);
687          final ThreadPoolExecutor p =
688              new CustomTPE(1, 1,
689                            LONG_DELAY_MS, MILLISECONDS,
# Line 718 | Line 718 | public class ThreadPoolExecutorSubclassT
718      public void testPurge() throws InterruptedException {
719          final CountDownLatch threadStarted = new CountDownLatch(1);
720          final CountDownLatch done = new CountDownLatch(1);
721 <        final BlockingQueue<Runnable> q = new ArrayBlockingQueue<Runnable>(10);
721 >        final BlockingQueue<Runnable> q = new ArrayBlockingQueue<>(10);
722          final ThreadPoolExecutor p =
723              new CustomTPE(1, 1,
724                            LONG_DELAY_MS, MILLISECONDS,
# Line 726 | Line 726 | public class ThreadPoolExecutorSubclassT
726          try (PoolCleaner cleaner = cleaner(p, done)) {
727              FutureTask[] tasks = new FutureTask[5];
728              for (int i = 0; i < tasks.length; i++) {
729 <                Callable task = new CheckedCallable<Boolean>() {
729 >                Callable<Boolean> task = new CheckedCallable<Boolean>() {
730                      public Boolean realCall() throws InterruptedException {
731                          threadStarted.countDown();
732                          await(done);
# Line 1505 | Line 1505 | public class ThreadPoolExecutorSubclassT
1505                            LONG_DELAY_MS, MILLISECONDS,
1506                            new ArrayBlockingQueue<Runnable>(10));
1507          try (PoolCleaner cleaner = cleaner(e)) {
1508 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1508 >            List<Callable<String>> l = new ArrayList<>();
1509              l.add(latchAwaitingStringTask(latch));
1510              l.add(null);
1511              try {
# Line 1525 | Line 1525 | public class ThreadPoolExecutorSubclassT
1525                            LONG_DELAY_MS, MILLISECONDS,
1526                            new ArrayBlockingQueue<Runnable>(10));
1527          try (PoolCleaner cleaner = cleaner(e)) {
1528 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1528 >            List<Callable<String>> l = new ArrayList<>();
1529              l.add(new NPETask());
1530              try {
1531                  e.invokeAny(l);
# Line 1545 | Line 1545 | public class ThreadPoolExecutorSubclassT
1545                            LONG_DELAY_MS, MILLISECONDS,
1546                            new ArrayBlockingQueue<Runnable>(10));
1547          try (PoolCleaner cleaner = cleaner(e)) {
1548 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1548 >            List<Callable<String>> l = new ArrayList<>();
1549              l.add(new StringTask());
1550              l.add(new StringTask());
1551              String result = e.invokeAny(l);
# Line 1592 | Line 1592 | public class ThreadPoolExecutorSubclassT
1592                            LONG_DELAY_MS, MILLISECONDS,
1593                            new ArrayBlockingQueue<Runnable>(10));
1594          try (PoolCleaner cleaner = cleaner(e)) {
1595 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1595 >            List<Callable<String>> l = new ArrayList<>();
1596              l.add(new StringTask());
1597              l.add(null);
1598              try {
# Line 1611 | Line 1611 | public class ThreadPoolExecutorSubclassT
1611                            LONG_DELAY_MS, MILLISECONDS,
1612                            new ArrayBlockingQueue<Runnable>(10));
1613          try (PoolCleaner cleaner = cleaner(e)) {
1614 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1614 >            List<Callable<String>> l = new ArrayList<>();
1615              l.add(new NPETask());
1616              List<Future<String>> futures = e.invokeAll(l);
1617              assertEquals(1, futures.size());
# Line 1633 | Line 1633 | public class ThreadPoolExecutorSubclassT
1633                            LONG_DELAY_MS, MILLISECONDS,
1634                            new ArrayBlockingQueue<Runnable>(10));
1635          try (PoolCleaner cleaner = cleaner(e)) {
1636 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1636 >            List<Callable<String>> l = new ArrayList<>();
1637              l.add(new StringTask());
1638              l.add(new StringTask());
1639              List<Future<String>> futures = e.invokeAll(l);
# Line 1668 | Line 1668 | public class ThreadPoolExecutorSubclassT
1668                            LONG_DELAY_MS, MILLISECONDS,
1669                            new ArrayBlockingQueue<Runnable>(10));
1670          try (PoolCleaner cleaner = cleaner(e)) {
1671 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1671 >            List<Callable<String>> l = new ArrayList<>();
1672              l.add(new StringTask());
1673              try {
1674                  e.invokeAny(l, MEDIUM_DELAY_MS, null);
# Line 1704 | Line 1704 | public class ThreadPoolExecutorSubclassT
1704                            LONG_DELAY_MS, MILLISECONDS,
1705                            new ArrayBlockingQueue<Runnable>(10));
1706          try (PoolCleaner cleaner = cleaner(e)) {
1707 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1707 >            List<Callable<String>> l = new ArrayList<>();
1708              l.add(latchAwaitingStringTask(latch));
1709              l.add(null);
1710              try {
# Line 1725 | Line 1725 | public class ThreadPoolExecutorSubclassT
1725                            new ArrayBlockingQueue<Runnable>(10));
1726          try (PoolCleaner cleaner = cleaner(e)) {
1727              long startTime = System.nanoTime();
1728 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1728 >            List<Callable<String>> l = new ArrayList<>();
1729              l.add(new NPETask());
1730              try {
1731                  e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS);
# Line 1747 | Line 1747 | public class ThreadPoolExecutorSubclassT
1747                            new ArrayBlockingQueue<Runnable>(10));
1748          try (PoolCleaner cleaner = cleaner(e)) {
1749              long startTime = System.nanoTime();
1750 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1750 >            List<Callable<String>> l = new ArrayList<>();
1751              l.add(new StringTask());
1752              l.add(new StringTask());
1753              String result = e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS);
# Line 1781 | Line 1781 | public class ThreadPoolExecutorSubclassT
1781                            LONG_DELAY_MS, MILLISECONDS,
1782                            new ArrayBlockingQueue<Runnable>(10));
1783          try (PoolCleaner cleaner = cleaner(e)) {
1784 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1784 >            List<Callable<String>> l = new ArrayList<>();
1785              l.add(new StringTask());
1786              try {
1787                  e.invokeAll(l, MEDIUM_DELAY_MS, null);
# Line 1814 | Line 1814 | public class ThreadPoolExecutorSubclassT
1814                            LONG_DELAY_MS, MILLISECONDS,
1815                            new ArrayBlockingQueue<Runnable>(10));
1816          try (PoolCleaner cleaner = cleaner(e)) {
1817 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1817 >            List<Callable<String>> l = new ArrayList<>();
1818              l.add(new StringTask());
1819              l.add(null);
1820              try {
# Line 1833 | Line 1833 | public class ThreadPoolExecutorSubclassT
1833                            LONG_DELAY_MS, MILLISECONDS,
1834                            new ArrayBlockingQueue<Runnable>(10));
1835          try (PoolCleaner cleaner = cleaner(e)) {
1836 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1836 >            List<Callable<String>> l = new ArrayList<>();
1837              l.add(new NPETask());
1838              List<Future<String>> futures =
1839                  e.invokeAll(l, LONG_DELAY_MS, MILLISECONDS);
# Line 1856 | Line 1856 | public class ThreadPoolExecutorSubclassT
1856                            LONG_DELAY_MS, MILLISECONDS,
1857                            new ArrayBlockingQueue<Runnable>(10));
1858          try (PoolCleaner cleaner = cleaner(e)) {
1859 <            List<Callable<String>> l = new ArrayList<Callable<String>>();
1859 >            List<Callable<String>> l = new ArrayList<>();
1860              l.add(new StringTask());
1861              l.add(new StringTask());
1862              List<Future<String>> futures =

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines