tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kfuj...@apache.org
Subject svn commit: r1156519 - /tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
Date Thu, 11 Aug 2011 07:39:44 GMT
Author: kfujino
Date: Thu Aug 11 07:39:44 2011
New Revision: 1156519

URL: http://svn.apache.org/viewvc?rev=1156519&view=rev
Log:
Unregisters MBean of DataSource when web application stops.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java

Modified: tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java?rev=1156519&r1=1156518&r2=1156519&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java Thu Aug 11 07:39:44
2011
@@ -23,6 +23,7 @@ import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -296,6 +297,13 @@ public class NamingContextListener
             }
 
             ContextAccessController.unsetSecurityToken(getName(), container);
+            
+            // unregister mbeans.
+            Collection<ObjectName> names = objectNames.values();
+            for (ObjectName objectName : names) {
+                Registry.getRegistry(null, null).unregisterComponent(objectName);
+            }
+            objectNames.clear();
 
             namingContext = null;
             envCtx = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message