This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push: new dbd4162c6f Stop avec init should be a noop dbd4162c6f is described below commit dbd4162c6f2144e6b01775b4b10b6f00a720fb8b Author: remm <r...@apache.org> AuthorDate: Wed Oct 30 09:43:36 2024 +0100 Stop avec init should be a noop Do not add FAILED_INIT state to differentiate from FAILED (during start) as this increases complexity a lot without providing any concrete benefits. Instead, connectors should use bindOnInit and throwOnFailure to achieve the desired behavior. Instead: - Init of components should be as robust as possible. If it fails, then the component will be FAILED. This means a start can happen next, in which case the component should detect that its state is wrong and fail again. After init, the component will always be considered to be initialized even in a failed state. If an exception is thrown from the component, it should probably occur in a finally in a controlled way. - Stop should be ok too after a failed init and try to "reinit" if possible (if not then too bad). A start would be occurring next. Tested with a connector with a bad configuration and the 4 options: bindOnInit="true/false" throwOnFailure="true/false". --- java/org/apache/catalina/util/LifecycleBase.java | 4 ++++ webapps/docs/changelog.xml | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/java/org/apache/catalina/util/LifecycleBase.java b/java/org/apache/catalina/util/LifecycleBase.java index ec7abb1b22..f614e5ea5d 100644 --- a/java/org/apache/catalina/util/LifecycleBase.java +++ b/java/org/apache/catalina/util/LifecycleBase.java @@ -209,6 +209,10 @@ public abstract class LifecycleBase implements Lifecycle { return; } + if (state.equals(LifecycleState.INITIALIZED)) { + return; + } + if (state.equals(LifecycleState.NEW)) { state = LifecycleState.STOPPED; return; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index f6fdba2bed..cb70e18949 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -197,6 +197,11 @@ controlled via the new <code>notFoundClassResourceCacheSize</code> on the StandardContext. (markt) </fix> + <fix> + Stop after <code>INITIALIZED</code> state should be a noop since it is + possible for subcomponents to be in <code>FAILED</code> after init. + (remm) + </fix> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org