I have a fixedThreadPool that I am using to run a bunch of worker threads to achieve parallel execution of a task with many components.
When all threads have finishe
If using Google Guava is an option, you could utilize the ListenableFuture interface in the following manner:
ExecutorService
to a ListeningExecutorService via MoreExecutors.listeningDecorator(existingExecutorService)
submit(Callable)
method of ListeningExecutorService
has been narrowed to return a ListenableFuture
, which is a subinterface of Future
.ListenableFuture
has an addListener()
method so you can register a callback to be run when the future is completed.