Solved

ThreadGroup active count really high for my servlet, why?

Posted on 2006-06-28
3
211 Views
Last Modified: 2013-11-24
I've got a section of code:

ThreadGroup tg = Thread.currentThread().getThreadGroup();

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??
0
Comment
Question by:arctanx
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 17005754
container will create new thread to handle requests, and it may also be using a thread pool.
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 17006356
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.
0
 
LVL 35

Accepted Solution

by:
girionis earned 100 total points
ID: 17007635
Most (if not all) of the containers use a thread pool. for more info have a look here: http://www.javaworld.com/javaworld/jw-06-2004/jw-0628-performance-p2.html
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java array passed to SQL where clause 23 62
compre toata in where clue oracle 4 56
How to increase Spring boot/Tomcat max file upload size 2 19
varialbe initialization 11 30
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now