DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22625>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22625 Removing a webapp(context) doesn't close its datasources(resource) ------- Additional Comments From [EMAIL PROTECTED] 2003-08-21 14:27 ------- Mail to tomcat-dev (20/08/2003) -------------------------------- Hi Here at commons-dbcp we have an open issue about the datasource not being closed when the webapp context is removed. http://issues.apache.org/bugzilla/show_bug.cgi?id=21182 There is a workaround but I think it should be fixed inside the container. The BasicDataSource tomcat is using has a close method but I don't think it is called. I've looked in the tomcat 4 source but cannot find anything related to closing/shutting down resources. I would do something like this in the NamingContextListener public void removeResource(String name) { try { Object resource = envCtx.lookup(name); Method closeMethod = resource.getClass().getMethod("close", null); closeMethod.invoke(resource, null); } catch (Exception e) { log("Cannot close resource " + e); } try { envCtx.unbind(name); } catch (NamingException e) { log(sm.getString("naming.unbindFailed", e)); } } Mind you, I have never even compiled tomcat so maybe I'm totally looking in the wrong place here. Other solutions would be implementing a special interface or factory method or ... We could of cource document the issue for tomcat 4 and fix it in 5. Comments? Regards Dirk --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]