Fix some inconsistencies identified during lifecycle refactoring for valves
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 6 Mar 2010 09:26:33 +0000 (09:26 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 6 Mar 2010 09:26:33 +0000 (09:26 +0000)
- don't start a basic valve when adding it to the pipeline if the pipeline is not started
- if pipeline is started when adding a basic valve, register the basic valve

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@919722 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/StandardPipeline.java

index 2584db1..bfe7112 100644 (file)
@@ -326,13 +326,15 @@ public class StandardPipeline extends LifecycleBase
         if (valve instanceof Contained) {
             ((Contained) valve).setContainer(this.container);
         }
-        if (valve instanceof Lifecycle) {
+        if (getState().isAvailable() && valve instanceof Lifecycle) {
             try {
                 ((Lifecycle) valve).start();
             } catch (LifecycleException e) {
                 log.error("StandardPipeline.setBasic: start", e);
                 return;
             }
+            // Register the newly added valve
+            registerValve(valve);
         }
 
         // Update the pipeline