tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hankin" <kei...@addr.com>
Subject Re: Multiple requests sharing the same Servlet instance
Date Wed, 16 Jun 2004 15:41:06 GMT
Yes, they're true objects. But if you instantiate more than one of them,
each will have identical state. While it's possible to have different state
to be set depending on different instances based upon the computing
environment at the time that the Servlet object is created, I don't see how
this type of different state is useful since the developer does not have any
control over when Servlets are instantiated.

----- Original Message -----
From: "QM" <qm300@brandxdev.net>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, June 16, 2004 8:04 PM
Subject: Re: Multiple requests sharing the same Servlet instance


> On Wed, Jun 16, 2004 at 07:53:07PM +0530, Keith Hankin wrote:
> : Maybe I'm being dumb, but it seems to me that based upon what I'm
hearing,
> : there is no benefit of doing Servlet instance pooling since the Servlets
> : aren't true objects; they are merely places to put code, since no local
> : state is useful.
>
> Depends on how you look at it: they are true objects in that they are
> self-referential, and hold some (shareable) state.
>
> Check out the javadoc for the HttpServlet class: by default, the
> ServletConfig and some other vars are shared, and you're more than
> welcome to share thread-safe objects (such as a logger).  I'd certainly
> call those local objects "useful."  =)
>
> -QM
>
> --
>
> software  -- http://www.brandxdev.net
> tech news -- http://www.RoarNetworX.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>


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


Mime
View raw message