michael michael - 1 year ago 140
Java Question

Active threads in ExecutorService

Any ideas how to determine the number of active threads running in ExecutorService?

Answer Source

Use a ThreadPoolExecutor implementation and call getActiveCount() on it:

int getActiveCount() 
// Returns the approximate number of threads that are actively executing tasks.

The ExecutorService interface does not provide a method for that, it depends on the implementation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download