Java Forkjoinpool awaitTermination() MethodThe 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. Syntax:Parameter:timeout - the time to wait unit - the time unit of the timeout argument this can be HOUR, SECONDS, DAY, etc. Returns:True if this executor terminated and false if the timeout elapsed before termination ThrowsInterruptedException Example 1Test it NowOutput: 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 NowOutput: numbers of core available in your processor:4 is terminated :false
Next TopicForkjoinpool awaitQuiescence()
|