My question is, how do I count the number of running threads in server?
Some thoughts: Whenever a request comes from a browser (client), server creates a thread (or take one thread from thread pool?) & that thread executes (takes care of) that request, once response sent, thread gets over (or goes back in thread pool?).
Now if I increase a counter whenever a new thread is created by server (say in the beginning of service() method, though thread is already created by this time & thread itself is executing this service() method) and decrease it when response is sent to browser (in the very end of service() method), will this give me right number?
Any listener I can make use of? Or anything OOB available?