888 |
|
CountDownLatch latch = new CountDownLatch(1); |
889 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
890 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
891 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
891 |
> |
List<Callable<String>> l = new ArrayList<>(); |
892 |
|
l.add(latchAwaitingStringTask(latch)); |
893 |
|
l.add(null); |
894 |
|
try { |
905 |
|
public void testInvokeAny4() throws Exception { |
906 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
907 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
908 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
908 |
> |
List<Callable<String>> l = new ArrayList<>(); |
909 |
|
l.add(new NPETask()); |
910 |
|
try { |
911 |
|
e.invokeAny(l); |
922 |
|
public void testInvokeAny5() throws Exception { |
923 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
924 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
925 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
925 |
> |
List<Callable<String>> l = new ArrayList<>(); |
926 |
|
l.add(new StringTask()); |
927 |
|
l.add(new StringTask()); |
928 |
|
String result = e.invokeAny(l); |
960 |
|
public void testInvokeAll3() throws Exception { |
961 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
962 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
963 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
963 |
> |
List<Callable<String>> l = new ArrayList<>(); |
964 |
|
l.add(new StringTask()); |
965 |
|
l.add(null); |
966 |
|
try { |
976 |
|
public void testInvokeAll4() throws Exception { |
977 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
978 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
979 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
979 |
> |
List<Callable<String>> l = new ArrayList<>(); |
980 |
|
l.add(new NPETask()); |
981 |
|
List<Future<String>> futures = e.invokeAll(l); |
982 |
|
assertEquals(1, futures.size()); |
995 |
|
public void testInvokeAll5() throws Exception { |
996 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
997 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
998 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
998 |
> |
List<Callable<String>> l = new ArrayList<>(); |
999 |
|
l.add(new StringTask()); |
1000 |
|
l.add(new StringTask()); |
1001 |
|
List<Future<String>> futures = e.invokeAll(l); |
1024 |
|
public void testTimedInvokeAnyNullTimeUnit() throws Exception { |
1025 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1026 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1027 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1027 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1028 |
|
l.add(new StringTask()); |
1029 |
|
try { |
1030 |
|
e.invokeAny(l, MEDIUM_DELAY_MS, null); |
1053 |
|
CountDownLatch latch = new CountDownLatch(1); |
1054 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1055 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1056 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1056 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1057 |
|
l.add(latchAwaitingStringTask(latch)); |
1058 |
|
l.add(null); |
1059 |
|
try { |
1071 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1072 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1073 |
|
long startTime = System.nanoTime(); |
1074 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1074 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1075 |
|
l.add(new NPETask()); |
1076 |
|
try { |
1077 |
|
e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS); |
1090 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1091 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1092 |
|
long startTime = System.nanoTime(); |
1093 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1093 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1094 |
|
l.add(new StringTask()); |
1095 |
|
l.add(new StringTask()); |
1096 |
|
String result = e.invokeAny(l, LONG_DELAY_MS, MILLISECONDS); |
1118 |
|
public void testTimedInvokeAllNullTimeUnit() throws Exception { |
1119 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1120 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1121 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1121 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1122 |
|
l.add(new StringTask()); |
1123 |
|
try { |
1124 |
|
e.invokeAll(l, MEDIUM_DELAY_MS, null); |
1145 |
|
public void testTimedInvokeAll3() throws Exception { |
1146 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1147 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1148 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1148 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1149 |
|
l.add(new StringTask()); |
1150 |
|
l.add(null); |
1151 |
|
try { |
1161 |
|
public void testTimedInvokeAll4() throws Exception { |
1162 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1163 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1164 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1164 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1165 |
|
l.add(new NPETask()); |
1166 |
|
List<Future<String>> futures = |
1167 |
|
e.invokeAll(l, LONG_DELAY_MS, MILLISECONDS); |
1181 |
|
public void testTimedInvokeAll5() throws Exception { |
1182 |
|
final ExecutorService e = new ScheduledThreadPoolExecutor(2); |
1183 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
1184 |
< |
List<Callable<String>> l = new ArrayList<Callable<String>>(); |
1184 |
> |
List<Callable<String>> l = new ArrayList<>(); |
1185 |
|
l.add(new StringTask()); |
1186 |
|
l.add(new StringTask()); |
1187 |
|
List<Future<String>> futures = |