Bug 33832

Summary: context attributes get lost
Product: Tomcat 5 Reporter: Oleg Mints <omints>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 5.5.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   

Description Oleg Mints 2005-03-03 18:35:53 UTC
I use ServletContextListener to start/stop of one internal working thread.

In contextInitialized(ServletContextEvent event) the Thread object will be 
created and started, than registred as an attribute:

ServletContext context = event.getServletContext();
MailerThread mailerThread = new MailerThread(...);
context.setAttribute("de.mints.interrisk.mail.thread", mailerThread) 

In contextDestroyed(ServletContextEvent event) the thread must be interrupted:

ServletContext context = event.getServletContext();
Thread thread = (Thread)context.getAttribute("de.mints.interrisk.mail.thread");
thread.interrupt();

Under Tomcat 5.5.4 it works fine, but under 5.5.7 thread == null. It seems the 
context's attributes go lost.
Comment 1 Oleg Mints 2005-03-03 18:40:07 UTC
It working under: Tomcat 5.5.4 / JDK 1.4.2_7
but not under Tomcat 5.5.7 / JDK 1.5.0_1
Comment 2 Mark Thomas 2005-03-05 22:02:59 UTC

*** This bug has been marked as a duplicate of 33463 ***