Author: kkolinko
Date: Thu May 8 19:15:25 2014
New Revision: 1593387
URL: http://svn.apache.org/r1593387
Log:
Small optimization: move "getRegistry(null, null)" call out of the loop.
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=1593387&r1=1593386&r2=1593387&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java Thu
May 8 19:15:25 2014
@@ -318,9 +318,12 @@ public class NamingContextListener
ContextAccessController.unsetSecurityToken(container, token);
// unregister mbeans.
- Collection<ObjectName> names = objectNames.values();
- for (ObjectName objectName : names) {
- Registry.getRegistry(null,
null).unregisterComponent(objectName);
+ if (!objectNames.isEmpty()) {
+ Collection<ObjectName> names = objectNames.values();
+ Registry registry = Registry.getRegistry(null, null);
+ for (ObjectName objectName : names) {
+ registry.unregisterComponent(objectName);
+ }
}
} finally {
objectNames.clear();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]