No need to remove LifecycleListeners from destroyed components
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 11 May 2010 11:06:02 +0000 (11:06 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 11 May 2010 11:06:02 +0000 (11:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@943081 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/connector/LocalStrings.properties
java/org/apache/catalina/connector/MapperListener.java

index dd9af68..5f85ebc 100644 (file)
@@ -82,6 +82,6 @@ mapperListener.unregisterContext=Unregister Context {0}
 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
index fd21b99..22ad67b 100644 (file)
@@ -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);
                 }
             }
         }