Java ForkJoinPool getActiveThreadCount() MethodThe 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 1Test it NowOutput: 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 2Test it NowOutput: Before invoking number of active thread :0 After invoking Numbers of active thread :10 Common Pool Size :10
Next TopicJava Forkjoinpool getAsyncMode Method
|