> 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"
> It is also said that "it is not always considered a 
> good practice."
> 
> Why is that so ?

Because, as you have inadvertently discovered, separate instances of the class 
are created for each purpose.  If you make the mytimer field static (along with 
any others you want to use in both instances) you won't have a problem.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.

Reply via email to