Author: markt
Date: Tue May 11 11:06:02 2010
New Revision: 943081

URL: http://svn.apache.org/viewvc?rev=943081&view=rev
Log:
No need to remove LifecycleListeners from destroyed components

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java

Modified: 
tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=943081&r1=943080&r2=943081&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/LocalStrings.properties Tue 
May 11 11:06:02 2010
@@ -82,6 +82,6 @@ mapperListener.unregisterContext=Unregis
 mapperListener.registerWrapper=Register Wrapper {0} in Context {1}
 mapperListener.addMBeanListenerFail=Failed to add MBean notification listener 
for connector [{0}] in domain [{1}]. Adding Hosts, Contexts and Wrappers will 
not be visible to the connector.
 mapperListener.removeMBeanListenerFail=Failed to remove MBean notification 
listener for connector [{0}] in domain [{1}]. This may result in a memory leak.
-mapperLister.lifecycleListenerFail=Failed to call method [{0}] on object 
[{1}]. Changes in the object state may not be correctly reflected in the mapper 
for connector [{2}] in domain [{3}].
+mapperLister.lifecycleListenerFail=Failed to add Lifecycle listener to object 
[{0}]. Changes in the object state may not be correctly reflected in the mapper 
for connector [{1}] in domain [{2}].
 
 inputBuffer.streamClosed=Stream closed

Modified: tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java?rev=943081&r1=943080&r2=943081&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java Tue May 
11 11:06:02 2010
@@ -204,14 +204,8 @@ public class MapperListener
             return;
         }
         
-        String methodName = null;
-        if (notification.getType().equals
+        if (!notification.getType().equals
                 (MBeanServerNotification.REGISTRATION_NOTIFICATION)) {
-            methodName = "addLifecycleListener";
-        } else if (notification.getType().equals
-                (MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
-            methodName = "removeLifecycleListener";
-        } else {
             return;
         }
         
@@ -230,21 +224,21 @@ public class MapperListener
             if ("Servlet".equals(type) || "WebModule".equals(type) ||
                     "Host".equals(type)) {
                 try {
-                    mBeanServer.invoke(objectName, methodName,
+                    mBeanServer.invoke(objectName, "addLifecycleListener",
                             new Object[] {this},
                             new String[] 
{"org.apache.catalina.LifecycleListener"});
                 } catch (ReflectionException e) {
                     log.error(sm.getString(
-                            "mapperLister.lifecycleListenerFail", methodName,
-                            objectName, connector, domain), e);
+                            "mapperLister.lifecycleListenerFail", objectName,
+                            connector, domain), e);
                 } catch (MBeanException e) {
                     log.error(sm.getString(
-                            "mapperLister.lifecycleListenerFail", methodName,
-                            objectName, connector, domain), e);
+                            "mapperLister.lifecycleListenerFail", objectName,
+                            connector, domain), e);
                 } catch (InstanceNotFoundException e) {
                     log.error(sm.getString(
-                            "mapperLister.lifecycleListenerFail", methodName,
-                            objectName, connector, domain), e);
+                            "mapperLister.lifecycleListenerFail", objectName,
+                            connector, domain), e);
                 }
             }
         }



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

Reply via email to