Author: markt
Date: Fri May 28 20:08:02 2010
New Revision: 949273

URL: http://svn.apache.org/viewvc?rev=949273&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49340
Simplify the mapper listener registration/de-registration process

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

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=949273&r1=949272&r2=949273&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/connector/MapperListener.java Fri May 
28 20:08:02 2010
@@ -132,6 +132,7 @@ public class MapperListener implements C
         if (event.getType() == Container.ADD_CHILD_EVENT) {
             Container child = (Container) event.getData();
             child.addLifecycleListener(this);
+            child.addContainerListener(this);
             if (child instanceof Host) {
                 registerHost((Host) child);
             } else if (child instanceof Context) {
@@ -141,7 +142,7 @@ public class MapperListener implements C
             }
         } else if (event.getType() == Container.REMOVE_CHILD_EVENT) {
             Container child = (Container) event.getData();
-            child.removeLifecycleListener(this);
+            removeListeners(child);
             if (child instanceof Host) {
                 unregisterHost((Host) child);
             } else if (child instanceof Context) {
@@ -291,8 +292,6 @@ public class MapperListener implements C
      */
     private void unregisterHost(Host host) {
 
-        removeListeners(host);
-        
         String hostname = host.getName();
         
         mapper.removeHost(hostname);
@@ -308,8 +307,6 @@ public class MapperListener implements C
      */
     private void unregisterWrapper(Wrapper wrapper) {
 
-        removeListeners(wrapper);
-        
         String contextName = wrapper.getParent().getName();
         if ("/".equals(contextName)) {
             contextName = "";
@@ -364,8 +361,6 @@ public class MapperListener implements C
             return;
         }
 
-        removeListeners(context);
-        
         String contextName = context.getName();
         if ("/".equals(contextName)) {
             contextName = "";



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

Reply via email to