From: remm Date: Tue, 1 May 2007 16:31:58 +0000 (+0000) Subject: - Add a flag to work around the double start problem for embedded (the most usual... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1c6fe8710fde3100ccecf55d2d672f5ef02d3c57;p=tomcat7.0 - Add a flag to work around the double start problem for embedded (the most usual problem is with contexts). git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@534147 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java index d2e3dc7a1..eae2d8eac 100644 --- a/java/org/apache/catalina/core/ContainerBase.java +++ b/java/org/apache/catalina/core/ContainerBase.java @@ -257,6 +257,11 @@ public abstract class ContainerBase 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 @@ public abstract class ContainerBase /** + * 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 null. */ @@ -755,7 +785,7 @@ public abstract class ContainerBase 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();