I see what you are doing with the very long timeout. But at the end of the day, it's not guaranteed that all tasks have finished when awaitTermination exits. The timeout could have been reached. It's better to await termination in a loop and check the return value. In that case you can dial down the timeout to something more reasonable like a few minutes.