Javatpoint Logo
Javatpoint Logo

Java ForkJoinPool getActiveThreadCount() Method

The getActiveThreadCount() method of ForkJoinPool class is used to estimate the number of active threads. This estimation may include stealing threads or currently executing the task. It may overestimate the number of active threads.

Syntax:

Parameter:

No parameter is passed.

Returns:

Return the number of active threads.

Throw:

Does not throw Exception.

Example 1

Test it Now

Output:

numbers of core available in your processor:4
 Before invoking number of active thread   :0
 After invoking Numbers of active thread   :3
Common Pool Size   :3

Example 2

Test it Now

Output:

Before invoking number of active thread   :0
 After invoking Numbers of active thread   :10
Common Pool Size   :10





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials