tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Felipe Schnack <>
Subject Re: servlets
Date Tue, 28 Jan 2003 21:39:33 GMT
> >  If I write an servlet and DO NOT implement the SingleThreadModel, I
> > have a guarantee that I'll have only one instance of it? If not, here is
> > a way to do this?
> No, there's no guarantee. As far as I can tell, there's no guarantee even
> with SingleThreadModel.
  As far as I understand it, if you implement  SingleThreadModel you can 
actually  guarantee that you have more than one instance :-)

> Only way to ensure this would be to make the Servlet itself simply a facade
> (Front end) to a different class that is basically a Singleton.
  Hmmm... wow
> Mind you this won't work if more than one JVM is perhaps involved, and
> Singletons can bring up painful issues regarding serialization of sessions
> if they happen to get stuck in one.
  I don't think multiple VMs is an issue... you would certainly have, in this
case, multiple singletons loaded (one for each VM), but all of your other 
classes would be isolated from one of them anyway
  Why there are problems with serialization?
> Otherwise, it would be straightforward, but you'll be synchronizing like a
> mad man, so don't expect a lot of throughput to multiple clients.
> Of course, the real question is not whether it's possible, but why is it
> necessary?
> Regards,
> Will Hartung
> (
> --
> To unsubscribe, e-mail:   <>
> For additional commands, e-mail: <>

Felipe Schnack
Analista de Sistemas
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
Fone/Fax.: (51)32303341

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message