arctanx
asked on
ThreadGroup active count really high for my servlet, why?
I've got a section of code:
ThreadGroup tg = Thread.currentThread().get ThreadGrou p();
When I get a sys out for this when my class is running as a service, in the main() method, it returns 1 or 2, as it should.
When I run the SAME CODE except now it's running as a servlet called from the init method it's returning 35, sometimes 40!! It's different everytime.
Why??
ThreadGroup tg = Thread.currentThread().get
When I get a sys out for this when my class is running as a service, in the main() method, it returns 1 or 2, as it should.
When I run the SAME CODE except now it's running as a servlet called from the init method it's returning 35, sometimes 40!! It's different everytime.
Why??
container will create new thread to handle requests, and it may also be using a thread pool.
Tomcat (or any other web container) uses threadpool to handle requests of the client. These threads belongs to same threadgroup which is different from main threadgroup.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.