Java Forkjoinpool awaitTermination() Method
The awaitTermination() method of ForkJoinPool class is used to await the termination after the shutdown request or the timeout specified as the parameter. The timeout elapses until the program shut down. When It is called with common-pool, It acts as the awaitQuiescence() method. It returns true if executor terminate and false if the time specified as timeout elapses.
timeout - the time to wait
unit - the time unit of the timeout argument this can be HOUR, SECONDS, DAY, etc.
True if this executor terminated and false if the timeout elapsed before termination
Example 1Test it Now
numbers of core available in your processor:4 Before awaitTermination (is terminated):false is awaitQuiescent :true After awaitTermination (is terminated):false Pool.invoke :161
Example 2Test it Now
numbers of core available in your processor:4 is terminated :false