Javatpoint Logo
Javatpoint Logo

Java ForkJoinPool awaitQuiescence() Method

The awaitQuiescence method of ForkJoinPool class is used to execute the task until this pool is quiescent if called by ForkJoinTask. Otherwise, it assists performing tasks until all the worker threads are idle. The thread which cannot lead a task to execute is called an idle thread.

Syntax:

Parameter:

timeout - the time to wait

unit - the time unit of the timeout argument this can be HOUR, SECONDS, DA, etc.

Returns:

True if quiescent; false if the timeout elapsed.

Throw:

Does not throw Exception.

Example 1

Test it Now

Output:

numbers of core available in your processor:4
 is Quiescent :true
Pool.invoke :161

Example 2

Test it Now

Output:

numbers of core available in your processor:4
 is awaitQuiescent :true





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials