The Executor framework allows you to execute concurrent tasks without worrying about thread creation and execution. It provides you the
Future class that you can use to control the status and get the results of any task executed in an executor.
When you want to wait for the finalization of a task, you can use the following two methods:
isDone()method of the
trueif the task has finished its execution.
awaitTermination()method of the
ThreadPoolExecutorclass puts the thread to sleep until all the tasks have finished their execution after a call to the
These two methods have some drawbacks. With the first one, you can only control the completion ...