From: markt Date: Fri, 28 May 2010 20:08:02 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49340 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=8acbd2917452891893b859632b4b9651213cea87;p=tomcat7.0 Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49340 Simplify the mapper listener registration/de-registration process git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@949273 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/connector/MapperListener.java b/java/org/apache/catalina/connector/MapperListener.java index 5395ca29c..5f77872a2 100644 --- a/java/org/apache/catalina/connector/MapperListener.java +++ b/java/org/apache/catalina/connector/MapperListener.java @@ -132,6 +132,7 @@ public class MapperListener implements ContainerListener, LifecycleListener { 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 ContainerListener, LifecycleListener { } } 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 ContainerListener, LifecycleListener { */ private void unregisterHost(Host host) { - removeListeners(host); - String hostname = host.getName(); mapper.removeHost(hostname); @@ -308,8 +307,6 @@ public class MapperListener implements ContainerListener, LifecycleListener { */ private void unregisterWrapper(Wrapper wrapper) { - removeListeners(wrapper); - String contextName = wrapper.getParent().getName(); if ("/".equals(contextName)) { contextName = ""; @@ -364,8 +361,6 @@ public class MapperListener implements ContainerListener, LifecycleListener { return; } - removeListeners(context); - String contextName = context.getName(); if ("/".equals(contextName)) { contextName = "";