This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 3d4dce54b2 Stop avec init should be a noop
3d4dce54b2 is described below

commit 3d4dce54b254d47b1a538e4b4086907f53f19f62
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 aba10cc4db..106d48a75d 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -199,6 +199,11 @@
         Implement WebDAV <code>PROPPATCH</code> method using the newly added
         <code>PropertyStore</code>. (remm)
       </update>
+      <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

Reply via email to