Problem Statement
Which sequence cleanly shuts down an ExecutorService?
Explanation
Call shutdown to reject new tasks and let running tasks finish. Await for a bounded time. If tasks still run, call shutdownNow to interrupt and drain the queue. This avoids leaks and dangling threads.
Practice Sets
This question appears in the following practice sets:
