Move firing the events to StandardPipeline. This way calls to container.addValve...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Feb 2010 22:09:18 +0000 (22:09 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Thu, 4 Feb 2010 22:09:18 +0000 (22:09 +0000)
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
java/org/apache/catalina/core/ContainerBase.java
java/org/apache/catalina/core/StandardPipeline.java

index 04a73b3..b566ff6 100644 (file)
@@ -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);
 }
index e4b0b43..a2bfb5c 100644 (file)
@@ -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);
     }
 
 
index 6391600..e69b572 100644 (file)
@@ -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;
     }
 }