Destroy method of Interceptor is never called by Struts -------------------------------------------------------
Key: WW-2381 URL: https://issues.apache.org/struts/browse/WW-2381 Project: Struts 2 Issue Type: Bug Components: Core Interceptors Affects Versions: 2.0.9 Environment: Window XP, Apache Tomcat 5.5.23, Java 5, Eclise 3.2 Reporter: Décio Heinzelmann Luckow I was testing the Interceptor behavior, and put an breakpoint inside the methods init and destroy of Interceptor (TestInterceptor created). The init method was ok, the breakpoint stopped on the server startup. To test the breakpoint of destroy method I does: - normal shutdown of tomcat (via Tomcat plugin in Eclipse) - redeploy the application - changed some classes to tomcat do the automatic reload But any of this cases the destroy method was called. I seach in the source code to find it and understand when it is called, but I don´t found. I use the 2.09 version, but is possible that it occurs in all versions of Struts2 Attached the conversation about this in dev-list Tom Schneider wrote: You know, I think you're right! I searched the entire codebase (both xwork and struts) and I have found nowhere where we call destroy() on the interceptors. I guess that hasn't been an issue because if the destroy isn't being called, no big deal because your usually shutting down anyway. If we were to call destroy on the interceptors, I would expect it to happen in the cleanup() method of Dispatcher. This is where all the rest of the cleanup happens. At runtime, the list of interceptors is stored in the ActionConfig object. (part of xwork) Perhaps it might be a good idea to submit a patch that fixes this issue. :) (hint, hint) Tom Dale Newfield wrote: This might be why undeploying a struts webapp tends to fail (the struts core and plugin jars can't be removed because they're still in use). Ted Husted wrote: I haven't traced the code, but I believe we redeploy the Interceptors in dev mode, making a destroy option more important. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.