Do I understand it right that Tomcat is launching all filters, then servlets and even JSPs in the same thread? Of course it can launch other thread and it will handle other filters and servlets, but is there are any logic how it launches it's own new thread? Or can I force somehow to launch EACH filter, EACH servlet, EACH jsp in a new thread of Tomcat?
The problem is that some servlets I use they are thread sensitive, and I've noticed that calling in these servlets return the same value - http-8080-Processor25, which explains to me that all of them are working inside the same Tomcat thread.
But can I force somehow to launch everything in a new thread??
And what are the guarantee that if Filter will be launched in the Tomcat thread, that Servlets which are in chain with the Filter will be in the same thread???
Thanks!!! [ August 17, 2006: Message edited by: Panda Mima ]
Do I understand it right that Tomcat is launching all filters, then servlets and even JSPs in the same thread?
That is a really odd statement!!! I suspect you are trying to create difficulties where none exist. The mental picture of how a servlet container works is quite a change from the picture of a desktop application.
In all servlet engines, Tomcat included, the container assigns a Thread to each request so if a request involves a filter, a servlet and a jsp, the same Thread handles them all. When the response has been finished, the container continues to manage the Thread, probably in some sort of pool, where it is available for the next request.
For example, my Tomcat server is set up for a maximum of 150 Threads but starts with a pool of 25 which is normally sufficient for the typical request load.