47 |
|
public void shutdown() { shutdown = true; } |
48 |
|
public List<Runnable> shutdownNow() { |
49 |
|
shutdown = true; |
50 |
< |
return Collections.EMPTY_LIST; |
50 |
> |
return Collections.emptyList(); |
51 |
|
} |
52 |
|
public boolean isShutdown() { return shutdown; } |
53 |
|
public boolean isTerminated() { return isShutdown(); } |
111 |
|
Runnable r = new CheckedRunnable() { |
112 |
|
public void realRun() throws Exception { |
113 |
|
ExecutorService e = new DirectExecutorService(); |
114 |
< |
Future future = e.submit(Executors.callable(new PrivilegedAction() { |
114 |
> |
Future<?> future = e.submit(Executors.callable(new PrivilegedAction<Object>() { |
115 |
|
public Object run() { |
116 |
|
return TEST_STRING; |
117 |
|
}})); |
132 |
|
Runnable r = new CheckedRunnable() { |
133 |
|
public void realRun() throws Exception { |
134 |
|
ExecutorService e = new DirectExecutorService(); |
135 |
< |
Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { |
135 |
> |
Future<?> future = e.submit(Executors.callable(new PrivilegedExceptionAction<Object>() { |
136 |
|
public Object run() { |
137 |
|
return TEST_STRING; |
138 |
|
}})); |
150 |
|
Runnable r = new CheckedRunnable() { |
151 |
|
public void realRun() throws Exception { |
152 |
|
ExecutorService e = new DirectExecutorService(); |
153 |
< |
Future future = e.submit(Executors.callable(new PrivilegedExceptionAction() { |
153 |
> |
Future<?> future = e.submit(Executors.callable(new PrivilegedExceptionAction<Object>() { |
154 |
|
public Object run() throws Exception { |
155 |
|
throw new IndexOutOfBoundsException(); |
156 |
|
}})); |
166 |
|
} |
167 |
|
|
168 |
|
/** |
169 |
< |
* Submitting null tasks throws NullPointerException. |
169 |
> |
* Submitting null tasks throws NullPointerException |
170 |
|
*/ |
171 |
< |
@SuppressWarnings("FutureReturnValueIgnored") |
172 |
< |
public void testNullTaskSubmission() throws Exception { |
171 |
> |
public void testNullTaskSubmission() { |
172 |
|
final ExecutorService e = new DirectExecutorService(); |
173 |
|
try (PoolCleaner cleaner = cleaner(e)) { |
174 |
< |
try { |
176 |
< |
e.execute((Runnable) null); |
177 |
< |
shouldThrow(); |
178 |
< |
} catch (NullPointerException success) {} |
179 |
< |
try { |
180 |
< |
e.submit((Runnable) null); |
181 |
< |
shouldThrow(); |
182 |
< |
} catch (NullPointerException success) {} |
183 |
< |
try { |
184 |
< |
e.submit((Callable) null); |
185 |
< |
shouldThrow(); |
186 |
< |
} catch (NullPointerException success) {} |
174 |
> |
assertNullTaskSubmissionThrowsNullPointerException(e); |
175 |
|
} |
176 |
|
} |
177 |
|
|
213 |
|
60, TimeUnit.SECONDS, |
214 |
|
new ArrayBlockingQueue<Runnable>(10)); |
215 |
|
try (PoolCleaner cleaner = cleaner(p)) { |
216 |
< |
Callable c = new Callable() { |
216 |
> |
Callable<Object> c = new Callable<Object>() { |
217 |
|
public Object call() { throw new ArithmeticException(); }}; |
218 |
|
try { |
219 |
|
p.submit(c).get(); |
584 |
|
e.invokeAll(tasks, timeout, MILLISECONDS); |
585 |
|
assertEquals(tasks.size(), futures.size()); |
586 |
|
assertTrue(millisElapsedSince(startTime) >= timeout); |
587 |
< |
for (Future future : futures) |
587 |
> |
for (Future<?> future : futures) |
588 |
|
assertTrue(future.isDone()); |
589 |
|
try { |
590 |
|
assertEquals("0", futures.get(0).get()); |