tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Hartung" <wi...@msoft.com>
Subject Re: servlets
Date Tue, 28 Jan 2003 21:37:16 GMT
> From: "Felipe Schnack" <felipes@ritterdosreis.br>
> Sent: Tuesday, January 28, 2003 1:05 PM
> Subject: servlets


>  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.

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.

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.

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
(willh@msoft.com)




--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message