tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Catalina vs.preServletInit et. al.
Date Fri, 23 Mar 2001 23:58:49 GMT

On Fri, 23 Mar 2001, Thom Park wrote:

> Hmm..
> interesting - In my modification(s) I was setting some
> thread-local objects which were then used by some objects
> referred to in my servlet.
> i.e. I was setting a naming-context such that it referred to the
> naming context that was appropriate for my execution thread.
> If I register an event-listener - can I be assured that it will
> run in the same thread as that using the servlet-instance? - in
> which case I home free.

Yes, it currently works that way.  And the J2EE RI (which embeds Tomcat
4.0) relies on this, for the same kinds of reasons you are talking about.

> If not, then one way to solve my problem would be to alter the
> wrapper class and 'wrap' the points where the servlet init,
> service and destroy method calls are invoked.
> Not very pluggable though and involves a nasty hack of the
> Catalina source.
> Are there any other alternatives to this?
> -Thom

Just as an aside, Tomcat 4.0 also provides a per-webapp JNDI context
containing resources configured in the <server.xml> file (and optionally
referenced in web.xml elements like <env-entry> and <resource-ref>).  It's
pretty straightforward to create your own object factories as well -- you
might want to see if leveraging that makes sense for you.


View raw message