"Nikola Milutinovic" <[EMAIL PROTECTED]> wrote in message 003b01c24f1c$fa2e6ba0$[EMAIL PROTECTED]">news:003b01c24f1c$fa2e6ba0$[EMAIL PROTECTED]... > >How should I control how many instances I want of a given servlet? > >In my case I would like just one. > > I don't think you can control that, usually there is only one instance per Servlet Engine. Are you trying to say that you don't want to have more than one REQUEST being handled by the servlet at one time (a complete request)? Then look at SingleThreadModel in Servlet specification. >
If you don't use STM, then there can be at most one instance of your Servlet per web-app. However, if your servlet lives in a jar in $CATALINA_HOME/shared/lib there is nothing to prevent you deploying it in hundreds of web-apps (each with a separate instance). Note that separate Hosts count as separate web-apps as far as Tomcat is concerned. If you do use STM, then you have no control at all over how many instances of your servlet will be created. All that you know is that no two threads will access the same instance at the same time. All top-level release versions of Tomcat currently implement STM pooling (at least by default). > Nix. > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>