On 10 Sep 2002, Craig Longman wrote:

> On Tue, 2002-09-10 at 15:48, Durham David Cntr 805CSS/SCBE wrote:
> >
> > Here's an example:
> >
> > <web-app>
> >   <listener>
> >     <listener-class>package.Listener</listener-class>
> >   </listener>
> > </web-app>
> >
> > I think this is what you should do if you are just initializing
> > some objects.  I'm using this on a project to initialize a cache of
> > "business" objects.
>
> ok, this works very well.  i have everything i need, as i can make the
> listener both a session and context listener, thanks very much.
>
> i have been unable to determine if the context listener part is a truly
> unique event though.  i would want exactly one contextInitialized()
> event, followed at some point by a contextDestroyed() event, without any
> other contextInitialized() events coming in between.  the docs aren't
> specific at all for this though, and i'm not sure.  in previous servlet
> containers, multiple servlets could be created, i'm not sure if each one
> would fire a contextInitialized() event.  how does this work in tomcat,
> should i be prepared to handle multiple contextInitialized() events?
> and what would that mean, something has changed or simply a new servlet
> was created?

Remember, you're talking about a context listener, not a servlet
listener.  Their lifecycles are different.  The servlet lifecycle is
pretty well known -- that is, it is possible that servlets can be
created and destroyed by the servlet container as it wishes.  So for
servlets, you have to be prepared for that.  I haven't heard as much
about the context lifecycle -- although I imagine they too can be
created and destroyed by the servlet container.  So you probably set
up your code to handle that possibility.

Milt Epstein
Research Programmer
Integration and Software Engineering (ISE)
Campus Information Technologies and Educational Services (CITES)
University of Illinois at Urbana-Champaign (UIUC)
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to