27 |
|
static class DirectExecutorService extends AbstractExecutorService { |
28 |
|
public void execute(Runnable r) { r.run(); } |
29 |
|
public void shutdown() { shutdown = true; } |
30 |
< |
public List shutdownNow() { shutdown = true; return Collections.EMPTY_LIST; } |
30 |
> |
public List<Runnable> shutdownNow() { shutdown = true; return Collections.EMPTY_LIST; } |
31 |
|
public boolean isShutdown() { return shutdown; } |
32 |
|
public boolean isTerminated() { return isShutdown(); } |
33 |
|
public boolean awaitTermination(long timeout, TimeUnit unit) { return isShutdown(); } |
48 |
|
ExecutorService e = new DirectExecutorService(); |
49 |
|
TrackedShortRunnable task = new TrackedShortRunnable(); |
50 |
|
assertFalse(task.done); |
51 |
< |
Future<?> future = e.submit(task); |
51 |
> |
Future<?> future = e.submit(task, null); |
52 |
|
future.get(); |
53 |
|
assertTrue(task.done); |
54 |
|
} |
212 |
|
try { |
213 |
|
ExecutorService e = new DirectExecutorService(); |
214 |
|
TrackedShortRunnable task = null; |
215 |
< |
Future<?> future = e.submit(task); |
215 |
> |
Future<?> future = e.submit(task, null); |
216 |
|
shouldThrow(); |
217 |
|
} |
218 |
|
catch (NullPointerException success) { |
282 |
|
try { |
283 |
|
|
284 |
|
for(int i = 0; i < 5; ++i){ |
285 |
< |
p.submit(new MediumRunnable()); |
285 |
> |
p.submit(new MediumRunnable(), null); |
286 |
|
} |
287 |
|
shouldThrow(); |
288 |
|
} catch(RejectedExecutionException success){} |
435 |
|
joinPool(p); |
436 |
|
} |
437 |
|
|
438 |
< |
} |
438 |
> |
} |