>-----Original Message-----
>From: Len Popp [mailto:len.p...@gmail.com]
>Subject: Re: Release COM Objects
>
>I would use a ServletContextListener. It gets notified when the webapp
>is initialized and destroyed.
>--
>Len


Filter vs ServletContextListener. 
When does Tomcat tell me in the logs that I might have a memory leak due to 
some threads not being released upon shutdown?  In a Filter or in a 
ServletContextListener?

SRV.9.12
When a web app is deployed, it does the following steps "in order"...

• Instantiate an instance of each event listener identified by a <listener> 
element
in the deployment descriptor.
• For instantiated listener instances that implement ServletContextListener,
call the contextInitialized() method.
• Instantiate an instance of each filter identified by a <filter> element in 
the deployment
descriptor and call each filter instance’s init() method.
• Instantiate an instance of each servlet identified by a <servlet> element that
includes a <load-on-startup> element in the order defined by the load-onstartup
element values, and call each servlet instance’s init() method.

When a web app is shutdown, does it do those same four steps in reverse order?

I'm guessing yes according to contextDestroyed() method. 
(.."All servlets and filters have been destroy()ed before any 
ServletContextListeners are notified of context destruction "...)

Reply via email to