7 |
|
*/ |
8 |
|
|
9 |
|
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
10 |
+ |
import static java.util.concurrent.TimeUnit.SECONDS; |
11 |
|
|
12 |
|
import java.util.ArrayList; |
13 |
|
import java.util.List; |
14 |
|
import java.util.concurrent.ArrayBlockingQueue; |
15 |
|
import java.util.concurrent.BlockingQueue; |
16 |
|
import java.util.concurrent.Callable; |
17 |
+ |
import java.util.concurrent.CancellationException; |
18 |
|
import java.util.concurrent.CountDownLatch; |
19 |
|
import java.util.concurrent.ExecutionException; |
20 |
|
import java.util.concurrent.Executors; |
38 |
|
|
39 |
|
public class ThreadPoolExecutorSubclassTest extends JSR166TestCase { |
40 |
|
public static void main(String[] args) { |
41 |
< |
junit.textui.TestRunner.run(suite()); |
41 |
> |
main(suite(), args); |
42 |
|
} |
43 |
|
public static Test suite() { |
44 |
|
return new TestSuite(ThreadPoolExecutorSubclassTest.class); |
60 |
|
CustomTask(final Runnable r, final V res) { |
61 |
|
if (r == null) throw new NullPointerException(); |
62 |
|
callable = new Callable<V>() { |
63 |
< |
public V call() throws Exception { r.run(); return res; }}; |
63 |
> |
public V call() throws Exception { r.run(); return res; }}; |
64 |
|
} |
65 |
|
public boolean isDone() { |
66 |
|
lock.lock(); try { return done; } finally { lock.unlock() ; } |
346 |
|
*/ |
347 |
|
public void testGetKeepAliveTime() { |
348 |
|
ThreadPoolExecutor p = new CustomTPE(2, 2, 1000, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
349 |
< |
assertEquals(1, p.getKeepAliveTime(TimeUnit.SECONDS)); |
349 |
> |
assertEquals(1, p.getKeepAliveTime(SECONDS)); |
350 |
|
joinPool(p); |
351 |
|
} |
352 |
|
|
699 |
|
} |
700 |
|
|
701 |
|
/** |
702 |
< |
* shutdownNow returns a list containing tasks that were not run |
702 |
> |
* shutdownNow returns a list containing tasks that were not run, |
703 |
> |
* and those tasks are drained from the queue |
704 |
|
*/ |
705 |
|
public void testShutdownNow() { |
706 |
|
ThreadPoolExecutor p = new CustomTPE(1, 1, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
715 |
|
} catch (SecurityException ok) { return; } |
716 |
|
} |
717 |
|
assertTrue(p.isShutdown()); |
718 |
+ |
assertTrue(p.getQueue().isEmpty()); |
719 |
|
assertTrue(l.size() <= 4); |
720 |
|
} |
721 |
|
|
726 |
|
*/ |
727 |
|
public void testConstructor1() { |
728 |
|
try { |
729 |
< |
new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
729 |
> |
new CustomTPE(-1, 1, 1L, SECONDS, |
730 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
731 |
|
shouldThrow(); |
732 |
|
} catch (IllegalArgumentException success) {} |
733 |
|
} |
737 |
|
*/ |
738 |
|
public void testConstructor2() { |
739 |
|
try { |
740 |
< |
new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
740 |
> |
new CustomTPE(1, -1, 1L, SECONDS, |
741 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
742 |
|
shouldThrow(); |
743 |
|
} catch (IllegalArgumentException success) {} |
744 |
|
} |
748 |
|
*/ |
749 |
|
public void testConstructor3() { |
750 |
|
try { |
751 |
< |
new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
751 |
> |
new CustomTPE(1, 0, 1L, SECONDS, |
752 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
753 |
|
shouldThrow(); |
754 |
|
} catch (IllegalArgumentException success) {} |
755 |
|
} |
759 |
|
*/ |
760 |
|
public void testConstructor4() { |
761 |
|
try { |
762 |
< |
new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
762 |
> |
new CustomTPE(1, 2, -1L, SECONDS, |
763 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
764 |
|
shouldThrow(); |
765 |
|
} catch (IllegalArgumentException success) {} |
766 |
|
} |
770 |
|
*/ |
771 |
|
public void testConstructor5() { |
772 |
|
try { |
773 |
< |
new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
773 |
> |
new CustomTPE(2, 1, 1L, SECONDS, |
774 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
775 |
|
shouldThrow(); |
776 |
|
} catch (IllegalArgumentException success) {} |
777 |
|
} |
781 |
|
*/ |
782 |
|
public void testConstructorNullPointerException() { |
783 |
|
try { |
784 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null); |
784 |
> |
new CustomTPE(1, 2, 1L, SECONDS, null); |
785 |
|
shouldThrow(); |
786 |
|
} catch (NullPointerException success) {} |
787 |
|
} |
791 |
|
*/ |
792 |
|
public void testConstructor6() { |
793 |
|
try { |
794 |
< |
new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
794 |
> |
new CustomTPE(-1, 1, 1L, SECONDS, |
795 |
> |
new ArrayBlockingQueue<Runnable>(10), |
796 |
> |
new SimpleThreadFactory()); |
797 |
|
shouldThrow(); |
798 |
|
} catch (IllegalArgumentException success) {} |
799 |
|
} |
803 |
|
*/ |
804 |
|
public void testConstructor7() { |
805 |
|
try { |
806 |
< |
new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
806 |
> |
new CustomTPE(1,-1, 1L, SECONDS, |
807 |
> |
new ArrayBlockingQueue<Runnable>(10), |
808 |
> |
new SimpleThreadFactory()); |
809 |
|
shouldThrow(); |
810 |
|
} catch (IllegalArgumentException success) {} |
811 |
|
} |
815 |
|
*/ |
816 |
|
public void testConstructor8() { |
817 |
|
try { |
818 |
< |
new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
818 |
> |
new CustomTPE(1, 0, 1L, SECONDS, |
819 |
> |
new ArrayBlockingQueue<Runnable>(10), |
820 |
> |
new SimpleThreadFactory()); |
821 |
|
shouldThrow(); |
822 |
|
} catch (IllegalArgumentException success) {} |
823 |
|
} |
827 |
|
*/ |
828 |
|
public void testConstructor9() { |
829 |
|
try { |
830 |
< |
new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
830 |
> |
new CustomTPE(1, 2, -1L, SECONDS, |
831 |
> |
new ArrayBlockingQueue<Runnable>(10), |
832 |
> |
new SimpleThreadFactory()); |
833 |
|
shouldThrow(); |
834 |
|
} catch (IllegalArgumentException success) {} |
835 |
|
} |
839 |
|
*/ |
840 |
|
public void testConstructor10() { |
841 |
|
try { |
842 |
< |
new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory()); |
842 |
> |
new CustomTPE(2, 1, 1L, SECONDS, |
843 |
> |
new ArrayBlockingQueue<Runnable>(10), |
844 |
> |
new SimpleThreadFactory()); |
845 |
|
shouldThrow(); |
846 |
|
} catch (IllegalArgumentException success) {} |
847 |
|
} |
851 |
|
*/ |
852 |
|
public void testConstructorNullPointerException2() { |
853 |
|
try { |
854 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new SimpleThreadFactory()); |
854 |
> |
new CustomTPE(1, 2, 1L, SECONDS, null, new SimpleThreadFactory()); |
855 |
|
shouldThrow(); |
856 |
|
} catch (NullPointerException success) {} |
857 |
|
} |
861 |
|
*/ |
862 |
|
public void testConstructorNullPointerException3() { |
863 |
|
try { |
864 |
< |
ThreadFactory f = null; |
865 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),f); |
864 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
865 |
> |
new ArrayBlockingQueue<Runnable>(10), |
866 |
> |
(ThreadFactory) null); |
867 |
|
shouldThrow(); |
868 |
|
} catch (NullPointerException success) {} |
869 |
|
} |
873 |
|
*/ |
874 |
|
public void testConstructor11() { |
875 |
|
try { |
876 |
< |
new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
876 |
> |
new CustomTPE(-1, 1, 1L, SECONDS, |
877 |
> |
new ArrayBlockingQueue<Runnable>(10), |
878 |
> |
new NoOpREHandler()); |
879 |
|
shouldThrow(); |
880 |
|
} catch (IllegalArgumentException success) {} |
881 |
|
} |
885 |
|
*/ |
886 |
|
public void testConstructor12() { |
887 |
|
try { |
888 |
< |
new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
888 |
> |
new CustomTPE(1, -1, 1L, SECONDS, |
889 |
> |
new ArrayBlockingQueue<Runnable>(10), |
890 |
> |
new NoOpREHandler()); |
891 |
|
shouldThrow(); |
892 |
|
} catch (IllegalArgumentException success) {} |
893 |
|
} |
897 |
|
*/ |
898 |
|
public void testConstructor13() { |
899 |
|
try { |
900 |
< |
new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
900 |
> |
new CustomTPE(1, 0, 1L, SECONDS, |
901 |
> |
new ArrayBlockingQueue<Runnable>(10), |
902 |
> |
new NoOpREHandler()); |
903 |
|
shouldThrow(); |
904 |
|
} catch (IllegalArgumentException success) {} |
905 |
|
} |
909 |
|
*/ |
910 |
|
public void testConstructor14() { |
911 |
|
try { |
912 |
< |
new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
912 |
> |
new CustomTPE(1, 2, -1L, SECONDS, |
913 |
> |
new ArrayBlockingQueue<Runnable>(10), |
914 |
> |
new NoOpREHandler()); |
915 |
|
shouldThrow(); |
916 |
|
} catch (IllegalArgumentException success) {} |
917 |
|
} |
921 |
|
*/ |
922 |
|
public void testConstructor15() { |
923 |
|
try { |
924 |
< |
new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new NoOpREHandler()); |
924 |
> |
new CustomTPE(2, 1, 1L, SECONDS, |
925 |
> |
new ArrayBlockingQueue<Runnable>(10), |
926 |
> |
new NoOpREHandler()); |
927 |
|
shouldThrow(); |
928 |
|
} catch (IllegalArgumentException success) {} |
929 |
|
} |
933 |
|
*/ |
934 |
|
public void testConstructorNullPointerException4() { |
935 |
|
try { |
936 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new NoOpREHandler()); |
936 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
937 |
> |
null, |
938 |
> |
new NoOpREHandler()); |
939 |
|
shouldThrow(); |
940 |
|
} catch (NullPointerException success) {} |
941 |
|
} |
945 |
|
*/ |
946 |
|
public void testConstructorNullPointerException5() { |
947 |
|
try { |
948 |
< |
RejectedExecutionHandler r = null; |
949 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),r); |
948 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
949 |
> |
new ArrayBlockingQueue<Runnable>(10), |
950 |
> |
(RejectedExecutionHandler) null); |
951 |
|
shouldThrow(); |
952 |
|
} catch (NullPointerException success) {} |
953 |
|
} |
957 |
|
*/ |
958 |
|
public void testConstructor16() { |
959 |
|
try { |
960 |
< |
new CustomTPE(-1,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
960 |
> |
new CustomTPE(-1, 1, 1L, SECONDS, |
961 |
> |
new ArrayBlockingQueue<Runnable>(10), |
962 |
> |
new SimpleThreadFactory(), |
963 |
> |
new NoOpREHandler()); |
964 |
|
shouldThrow(); |
965 |
|
} catch (IllegalArgumentException success) {} |
966 |
|
} |
970 |
|
*/ |
971 |
|
public void testConstructor17() { |
972 |
|
try { |
973 |
< |
new CustomTPE(1,-1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
973 |
> |
new CustomTPE(1, -1, 1L, SECONDS, |
974 |
> |
new ArrayBlockingQueue<Runnable>(10), |
975 |
> |
new SimpleThreadFactory(), |
976 |
> |
new NoOpREHandler()); |
977 |
|
shouldThrow(); |
978 |
|
} catch (IllegalArgumentException success) {} |
979 |
|
} |
983 |
|
*/ |
984 |
|
public void testConstructor18() { |
985 |
|
try { |
986 |
< |
new CustomTPE(1,0,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
986 |
> |
new CustomTPE(1, 0, 1L, SECONDS, |
987 |
> |
new ArrayBlockingQueue<Runnable>(10), |
988 |
> |
new SimpleThreadFactory(), |
989 |
> |
new NoOpREHandler()); |
990 |
|
shouldThrow(); |
991 |
|
} catch (IllegalArgumentException success) {} |
992 |
|
} |
996 |
|
*/ |
997 |
|
public void testConstructor19() { |
998 |
|
try { |
999 |
< |
new CustomTPE(1,2,-1L,MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
999 |
> |
new CustomTPE(1, 2, -1L, SECONDS, |
1000 |
> |
new ArrayBlockingQueue<Runnable>(10), |
1001 |
> |
new SimpleThreadFactory(), |
1002 |
> |
new NoOpREHandler()); |
1003 |
|
shouldThrow(); |
1004 |
|
} catch (IllegalArgumentException success) {} |
1005 |
|
} |
1009 |
|
*/ |
1010 |
|
public void testConstructor20() { |
1011 |
|
try { |
1012 |
< |
new CustomTPE(2,1,LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),new NoOpREHandler()); |
1012 |
> |
new CustomTPE(2, 1, 1L, SECONDS, |
1013 |
> |
new ArrayBlockingQueue<Runnable>(10), |
1014 |
> |
new SimpleThreadFactory(), |
1015 |
> |
new NoOpREHandler()); |
1016 |
|
shouldThrow(); |
1017 |
|
} catch (IllegalArgumentException success) {} |
1018 |
|
} |
1022 |
|
*/ |
1023 |
|
public void testConstructorNullPointerException6() { |
1024 |
|
try { |
1025 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,null,new SimpleThreadFactory(),new NoOpREHandler()); |
1025 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
1026 |
> |
null, |
1027 |
> |
new SimpleThreadFactory(), |
1028 |
> |
new NoOpREHandler()); |
1029 |
|
shouldThrow(); |
1030 |
|
} catch (NullPointerException success) {} |
1031 |
|
} |
1035 |
|
*/ |
1036 |
|
public void testConstructorNullPointerException7() { |
1037 |
|
try { |
1038 |
< |
RejectedExecutionHandler r = null; |
1039 |
< |
new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10),new SimpleThreadFactory(),r); |
1038 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
1039 |
> |
new ArrayBlockingQueue<Runnable>(10), |
1040 |
> |
new SimpleThreadFactory(), |
1041 |
> |
(RejectedExecutionHandler) null); |
1042 |
|
shouldThrow(); |
1043 |
|
} catch (NullPointerException success) {} |
1044 |
|
} |
1048 |
|
*/ |
1049 |
|
public void testConstructorNullPointerException8() { |
1050 |
|
try { |
1051 |
< |
new CustomTPE(1, 2, |
999 |
< |
LONG_DELAY_MS, MILLISECONDS, |
1051 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
1052 |
|
new ArrayBlockingQueue<Runnable>(10), |
1053 |
|
(ThreadFactory) null, |
1054 |
|
new NoOpREHandler()); |
1226 |
|
* execute(null) throws NPE |
1227 |
|
*/ |
1228 |
|
public void testExecuteNull() { |
1229 |
< |
ThreadPoolExecutor p = null; |
1229 |
> |
ThreadPoolExecutor p = |
1230 |
> |
new CustomTPE(1, 2, 1L, SECONDS, |
1231 |
> |
new ArrayBlockingQueue<Runnable>(10)); |
1232 |
|
try { |
1179 |
– |
p = new CustomTPE(1,2,LONG_DELAY_MS, MILLISECONDS,new ArrayBlockingQueue<Runnable>(10)); |
1233 |
|
p.execute(null); |
1234 |
|
shouldThrow(); |
1235 |
|
} catch (NullPointerException success) {} |
1740 |
|
public void testTimedInvokeAll6() throws Exception { |
1741 |
|
ExecutorService e = new CustomTPE(2, 2, LONG_DELAY_MS, MILLISECONDS, new ArrayBlockingQueue<Runnable>(10)); |
1742 |
|
try { |
1743 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1744 |
< |
l.add(new StringTask()); |
1745 |
< |
l.add(Executors.callable(new MediumPossiblyInterruptedRunnable(), TEST_STRING)); |
1746 |
< |
l.add(new StringTask()); |
1747 |
< |
List<Future<String>> futures = |
1748 |
< |
e.invokeAll(l, SHORT_DELAY_MS, MILLISECONDS); |
1749 |
< |
assertEquals(l.size(), futures.size()); |
1750 |
< |
for (Future future : futures) |
1751 |
< |
assertTrue(future.isDone()); |
1752 |
< |
assertFalse(futures.get(0).isCancelled()); |
1753 |
< |
assertTrue(futures.get(1).isCancelled()); |
1743 |
> |
for (long timeout = timeoutMillis();;) { |
1744 |
> |
List<Callable<String>> tasks = new ArrayList<>(); |
1745 |
> |
tasks.add(new StringTask("0")); |
1746 |
> |
tasks.add(Executors.callable(new LongPossiblyInterruptedRunnable(), TEST_STRING)); |
1747 |
> |
tasks.add(new StringTask("2")); |
1748 |
> |
long startTime = System.nanoTime(); |
1749 |
> |
List<Future<String>> futures = |
1750 |
> |
e.invokeAll(tasks, timeout, MILLISECONDS); |
1751 |
> |
assertEquals(tasks.size(), futures.size()); |
1752 |
> |
assertTrue(millisElapsedSince(startTime) >= timeout); |
1753 |
> |
for (Future future : futures) |
1754 |
> |
assertTrue(future.isDone()); |
1755 |
> |
assertTrue(futures.get(1).isCancelled()); |
1756 |
> |
try { |
1757 |
> |
assertEquals("0", futures.get(0).get()); |
1758 |
> |
assertEquals("2", futures.get(2).get()); |
1759 |
> |
break; |
1760 |
> |
} catch (CancellationException retryWithLongerTimeout) { |
1761 |
> |
timeout *= 2; |
1762 |
> |
if (timeout >= LONG_DELAY_MS / 2) |
1763 |
> |
fail("expected exactly one task to be cancelled"); |
1764 |
> |
} |
1765 |
> |
} |
1766 |
|
} finally { |
1767 |
|
joinPool(e); |
1768 |
|
} |
1805 |
|
* allowCoreThreadTimeOut(true) causes idle threads to time out |
1806 |
|
*/ |
1807 |
|
public void testAllowCoreThreadTimeOut_true() throws Exception { |
1808 |
< |
long coreThreadTimeOut = SHORT_DELAY_MS; |
1808 |
> |
long keepAliveTime = timeoutMillis(); |
1809 |
|
final ThreadPoolExecutor p = |
1810 |
|
new CustomTPE(2, 10, |
1811 |
< |
coreThreadTimeOut, MILLISECONDS, |
1811 |
> |
keepAliveTime, MILLISECONDS, |
1812 |
|
new ArrayBlockingQueue<Runnable>(10)); |
1813 |
|
final CountDownLatch threadStarted = new CountDownLatch(1); |
1814 |
|
try { |
1815 |
|
p.allowCoreThreadTimeOut(true); |
1816 |
|
p.execute(new CheckedRunnable() { |
1817 |
< |
public void realRun() throws InterruptedException { |
1817 |
> |
public void realRun() { |
1818 |
|
threadStarted.countDown(); |
1819 |
|
assertEquals(1, p.getPoolSize()); |
1820 |
|
}}); |
1821 |
|
await(threadStarted); |
1822 |
< |
delay(coreThreadTimeOut); |
1822 |
> |
delay(keepAliveTime); |
1823 |
|
long startTime = System.nanoTime(); |
1824 |
|
while (p.getPoolSize() > 0 |
1825 |
|
&& millisElapsedSince(startTime) < LONG_DELAY_MS) |
1835 |
|
* allowCoreThreadTimeOut(false) causes idle threads not to time out |
1836 |
|
*/ |
1837 |
|
public void testAllowCoreThreadTimeOut_false() throws Exception { |
1838 |
< |
long coreThreadTimeOut = SHORT_DELAY_MS; |
1838 |
> |
long keepAliveTime = timeoutMillis(); |
1839 |
|
final ThreadPoolExecutor p = |
1840 |
|
new CustomTPE(2, 10, |
1841 |
< |
coreThreadTimeOut, MILLISECONDS, |
1841 |
> |
keepAliveTime, MILLISECONDS, |
1842 |
|
new ArrayBlockingQueue<Runnable>(10)); |
1843 |
|
final CountDownLatch threadStarted = new CountDownLatch(1); |
1844 |
|
try { |
1848 |
|
threadStarted.countDown(); |
1849 |
|
assertTrue(p.getPoolSize() >= 1); |
1850 |
|
}}); |
1851 |
< |
delay(2 * coreThreadTimeOut); |
1851 |
> |
delay(2 * keepAliveTime); |
1852 |
|
assertTrue(p.getPoolSize() >= 1); |
1853 |
|
} finally { |
1854 |
|
joinPool(p); |