Hi!
My question is about how the
servlets gets started and if they all end up in the same VM.
Some data:
I'm using Tomcat4 and have implemented 2 servlets
- StartupServlet (sets up the environment with the db and reads some config)
- AdminServlet (this is the servlet that gets called everytime from the web server)
The StartupServlet starts around 10 new threads.
*When I just start
tomcat, I can see 12
java threads on the linux machine.
*When I set StartupServlet to <load-on-startup> I see 22 threads.
*When I then send the first request to the AdminServlet, I can see in the printouts that it first runs init on StartupServlet again and then on the AdminServlet. I now have 33 threads.
My question is if someone knows why it inits StartupServlet again? When it does that, will it be in the same JVM as the first init och StartupServlet? Have anyone a good tpi how to solve this without using the StartupSerlvet approach, i.e. I want to initialize the system before I get the first request to AdminServlet. In the future I will have more servlets like AdminServlet that can be called from a browser.
another question: if I have two connectors, one for http and one for https, will the servlets they start "share" the same JVM?
Any suggestions appriciated!
// Andreas