Author: remm
Date: Tue May  1 09:31:58 2007
New Revision: 534147

URL: http://svn.apache.org/viewvc?view=rev&rev=534147
Log:
- Add a flag to work around the double start problem for embedded (the most 
usual problem is with contexts).

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ContainerBase.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ContainerBase.java?view=diff&rev=534147&r1=534146&r2=534147
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ContainerBase.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/core/ContainerBase.java Tue 
May  1 09:31:58 2007
@@ -257,6 +257,11 @@
     protected boolean initialized=false;
 
     /**
+     * Will children be started automatically when they are added.
+     */
+    protected boolean startChildren = true;
+
+    /**
      * The property change support for this component.
      */
     protected PropertyChangeSupport support = new PropertyChangeSupport(this);
@@ -538,6 +543,31 @@
 
 
     /**
+     * Return if children of this container will be started automatically when
+     * they are added to this container.
+     */
+    public boolean getStartChildren() {
+
+        return (startChildren);
+
+    }
+
+
+    /**
+     * Set if children of this container will be started automatically when
+     * they are added to this container.
+     *
+     * @param startChildren New value of the startChildren flag
+     */
+    public void setStartChildren(boolean startChildren) {
+
+        boolean oldStartChildren = this.startChildren;
+        this.startChildren = startChildren;
+        support.firePropertyChange("startChildren", oldStartChildren, 
this.startChildren);
+    }
+
+
+    /**
      * Return the Container for which this Container is a child, if there is
      * one.  If there is no defined parent, return <code>null</code>.
      */
@@ -755,7 +785,7 @@
             children.put(child.getName(), child);
 
             // Start child
-            if (started && (child instanceof Lifecycle)) {
+            if (started && startChildren && (child instanceof Lifecycle)) {
                 boolean success = false;
                 try {
                     ((Lifecycle) child).start();



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to