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.56 by jsr166, Mon Sep 14 00:33:41 2015 UTC vs.
Revision 1.57 by jsr166, Mon Sep 14 00:42:48 2015 UTC

# Line 1961 | Line 1961 | public class ThreadPoolExecutorTest exte
1961       * allowCoreThreadTimeOut(true) causes idle threads to time out
1962       */
1963      public void testAllowCoreThreadTimeOut_true() throws Exception {
1964 <        long coreThreadTimeOut = SHORT_DELAY_MS;
1964 >        long keepAliveTime = timeoutMillis();
1965          final ThreadPoolExecutor p =
1966              new ThreadPoolExecutor(2, 10,
1967 <                                   coreThreadTimeOut, MILLISECONDS,
1967 >                                   keepAliveTime, MILLISECONDS,
1968                                     new ArrayBlockingQueue<Runnable>(10));
1969          final CountDownLatch threadStarted = new CountDownLatch(1);
1970          try {
# Line 1975 | Line 1975 | public class ThreadPoolExecutorTest exte
1975                      assertEquals(1, p.getPoolSize());
1976                  }});
1977              await(threadStarted);
1978 <            delay(coreThreadTimeOut);
1978 >            delay(keepAliveTime);
1979              long startTime = System.nanoTime();
1980              while (p.getPoolSize() > 0
1981                     && millisElapsedSince(startTime) < LONG_DELAY_MS)
# Line 1991 | Line 1991 | public class ThreadPoolExecutorTest exte
1991       * allowCoreThreadTimeOut(false) causes idle threads not to time out
1992       */
1993      public void testAllowCoreThreadTimeOut_false() throws Exception {
1994 <        long coreThreadTimeOut = SHORT_DELAY_MS;
1994 >        long keepAliveTime = timeoutMillis();
1995          final ThreadPoolExecutor p =
1996              new ThreadPoolExecutor(2, 10,
1997 <                                   coreThreadTimeOut, MILLISECONDS,
1997 >                                   keepAliveTime, MILLISECONDS,
1998                                     new ArrayBlockingQueue<Runnable>(10));
1999          final CountDownLatch threadStarted = new CountDownLatch(1);
2000          try {
# Line 2004 | Line 2004 | public class ThreadPoolExecutorTest exte
2004                      threadStarted.countDown();
2005                      assertTrue(p.getPoolSize() >= 1);
2006                  }});
2007 <            delay(2 * coreThreadTimeOut);
2007 >            delay(2 * keepAliveTime);
2008              assertTrue(p.getPoolSize() >= 1);
2009          } finally {
2010              joinPool(p);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines