Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Mark Thomas
On 26/05/2010 21:33, Christopher Schultz wrote: > I'd bet that Tomcat's "stop leaks" procedure is clearing-out a > static Timer reference and /then/ the ServletContextListener is trying > to access it. I'll take that bet. How much ;) > That's not supposed to happen, I'm guessing: the "stop > leak

Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Emeric Vernat
Hi Chris, The initial submitter had a HttpServlet implementing ServletContextListener with a non static timer, and in fact there were 2 instances of the class: the contextDestroyed method of the servletContextListener instance can't cancel the timer of the httpServlet instance (NullPointerExc

RE: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: Stopping a Timer in contextDestroyed() to avoid memory > leaks results in a NullPointerException > > I'd bet that Tomcat's "stop leaks" procedure is clearing-out a >

Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Emeric, On 5/26/2010 3:52 PM, Emeric Vernat wrote: > You could also eliminate the mix & match and add a finally, with the > following servlet code for example: > > public void init() throws ServletException { >boolean initOk = false;

Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Emeric Vernat
] Subject: Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException "You can optionally also let your servlet both extend HttpServlet and implement ServletContextListener" It is also said that "it is not always considered a good practice." Why

RE: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Caldarale, Charles R
> From: roberto calosino [mailto:devn...@web.de] > Subject: Re: Stopping a Timer in contextDestroyed() to avoid memory > leaks results in a NullPointerException > > "You can optionally also let your servlet both extend > HttpServlet and implement ServletContextListener"

Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread roberto calosino
but others not ? Thank you for your help. -Ursprüngliche Nachricht- Von: Pid Gesendet: 26.05.2010 20:45:53 An: Tomcat Users List Betreff: Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException >On 26/05/2010 19:43, devn...@web.de wro

Re: Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread Pid
On 26/05/2010 19:43, devn...@web.de wrote: > Hi, > > Thanks for reading this. > > I am developing a webapp and do not understand the following: > In my app, I create a Timer when the servlet starts. > When tomcat stops, I try to stop the timer in order to avoid memory leaks. > > My question is:

Stopping a Timer in contextDestroyed() to avoid memory leaks results in a NullPointerException

2010-05-26 Thread devnull
Hi, Thanks for reading this. I am developing a webapp and do not understand the following: In my app, I create a Timer when the servlet starts. When tomcat stops, I try to stop the timer in order to avoid memory leaks. My question is: why do I get a NullPointerException while trying to access m