How to signal the caller thread that ExecutorService has finished a task

concurrency, executorservice, java, multithreading

Solution

`submit` returns a `Future` on which the submitting thread can call `get` to block until the task completes.

Future<?> future = executor.submit(new Runnable() { ... });
future.get();

Problem

From the main thread: ``` executorService.submit(new Runnable() { ... }); ``` Now when Runnable has finished executing, is there the Java's standard way of signaling the caller thread that it has finished executing, without making a new interface/listener class? Bonus points if the signal can be emitted from the caller thread.

Original source