I totally agree, but sometimes you want a single instance of a servlet anyway
On Tue, 2002-12-10 at 23:33, Craig R. McClanahan wrote: > > > On Mon, 9 Dec 2002, David Boyer wrote: > > > Date: Mon, 09 Dec 2002 12:19:12 -0600 > > From: David Boyer <[EMAIL PROTECTED]> > > Reply-To: Tomcat Users List <[EMAIL PROTECTED]> > > To: [EMAIL PROTECTED] > > Subject: Q: SingleThreadModel and Tomcat > > > > It seems like different servlet containers vary in how they approach access to >classes that implement SingleThreadModel. When multiple threads want to access the >class, some servlet containers will create multiple instances of the class while >others queue the threads for exclusive access to a single instance of the class. > > > > Which approach does Tomcat take? > > > > Until relatively recently, Tomcat did the latter approach. Current > versions support a pool of instances. > > However, in general, I would recommend against usting SingleThreadModel in > your applications. The sense of thread safety that you get is an illusion > if you're also using sessions - it's very easy to triger multiple requests > to the same session at the same time. In addition, dealing with the pool > of STM servlet instances is just wasted overhead that slows your app down. > > Far better would be to learn how to write thread-safe servlets in the > first place. It's not that hard -- the principal thing to avoid is using > instance variables (in your servlets) to represent state information for a > particular request. > > Craig > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- Felipe Schnack Analista de Sistemas [EMAIL PROTECTED] Cel.: (51)91287530 Linux Counter #281893 Faculdade Ritter dos Reis www.ritterdosreis.br [EMAIL PROTECTED] Fone/Fax.: (51)32303328 -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>