Which method in the ExecutorService interface waits for all tasks to complete after a shutdown request?
- awaitShutdown()
- awaitTermination()
- isTerminated()
- shutdownNow()
The awaitTermination() method in the ExecutorService interface is used to wait for all tasks to complete after a shutdown request has been made using the shutdown() method. It blocks until all tasks have completed or the specified timeout has passed. The isTerminated() method checks if the ExecutorService has terminated but doesn't wait.
Loading...
Related Quiz
- What is the worst-case time complexity of Linear Search?
- What will be the output of the following code snippet: System.out.println(10 + 20 + "Hello" + 30 + 40);?
- How does Java handle the division of an integer by zero?
- Using ________, we can perform cleanup operations when the stream is closed.
- What is the primary benefit of using Lambda expressions in Java?