From 47b3aa7a3047740702c5c9046303f905ba367aa0 Mon Sep 17 00:00:00 2001 From: markt Date: Thu, 4 Feb 2010 22:09:18 +0000 Subject: [PATCH] Move firing the events to StandardPipeline. This way calls to container.addValve() and container.getPipeline().addValve() will both trigger the event. Custom pipelines (unlikely but possible) would not trigger the event. The javadocs for Pipeline will be updated to note that they should in a following commit. Part of removing the Pipeline interface from ContainerBase git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@906680 13f79535-47bb-0310-9956-ffa450edef68 --- java/org/apache/catalina/Container.java | 9 +++++++++ java/org/apache/catalina/core/ContainerBase.java | 2 -- java/org/apache/catalina/core/StandardPipeline.java | 8 +++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/java/org/apache/catalina/Container.java b/java/org/apache/catalina/Container.java index 04a73b33f..b566ff6b2 100644 --- a/java/org/apache/catalina/Container.java +++ b/java/org/apache/catalina/Container.java @@ -440,4 +440,13 @@ public interface Container { public void removePropertyChangeListener(PropertyChangeListener listener); + /** + * Notify all container event listeners that a particular event has + * occurred for this Container. The default implementation performs + * this notification synchronously using the calling thread. + * + * @param type Event type + * @param data Event data + */ + public void fireContainerEvent(String type, Object data); } diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index e4b0b4362..a2bfb5c75 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -1215,7 +1215,6 @@ public abstract class ContainerBase public synchronized void addValve(Valve valve) { pipeline.addValve(valve); - fireContainerEvent(ADD_VALVE_EVENT, valve); } public ObjectName[] getValveObjectNames() { @@ -1264,7 +1263,6 @@ public abstract class ContainerBase public synchronized void removeValve(Valve valve) { pipeline.removeValve(valve); - fireContainerEvent(REMOVE_VALVE_EVENT, valve); } diff --git a/java/org/apache/catalina/core/StandardPipeline.java b/java/org/apache/catalina/core/StandardPipeline.java index 63916009e..e69b572cf 100644 --- a/java/org/apache/catalina/core/StandardPipeline.java +++ b/java/org/apache/catalina/core/StandardPipeline.java @@ -472,7 +472,8 @@ public class StandardPipeline current = current.getNext(); } } - + + container.fireContainerEvent(Container.ADD_VALVE_EVENT, valve); } @@ -558,14 +559,15 @@ public class StandardPipeline unregisterValve(valve); } + container.fireContainerEvent(Container.REMOVE_VALVE_EVENT, valve); } public Valve getFirst() { if (first != null) { return first; - } else { - return basic; } + + return basic; } } -- 2.11.0