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

markt-asf 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 e94ad495dc Follow-up to ba91d79a
e94ad495dc is described below

commit e94ad495dc51008334a7e67a34263dd229cd0e63
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Sep 30 13:52:19 2026 +0100

    Follow-up to ba91d79a
    
    Ensure the listener is added to subsequently added Engines and Hosts
---
 java/org/apache/catalina/core/FrameworkListener.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/core/FrameworkListener.java 
b/java/org/apache/catalina/core/FrameworkListener.java
index e755cb325b..b03b9b62b6 100644
--- a/java/org/apache/catalina/core/FrameworkListener.java
+++ b/java/org/apache/catalina/core/FrameworkListener.java
@@ -83,7 +83,6 @@ public abstract class FrameworkListener implements 
LifecycleListener, ContainerL
         for (Service service : server.findServices()) {
             Engine engine = service.getContainer();
             if (engine != null) {
-                addContainerListenerIfAbsent(engine);
                 registerListenersForEngine(engine);
             }
         }
@@ -112,24 +111,28 @@ public abstract class FrameworkListener implements 
LifecycleListener, ContainerL
      * @param engine The engine to register listeners for
      */
     protected void registerListenersForEngine(Engine engine) {
+        addContainerListenerIfAbsent(engine);
         for (Container hostContainer : engine.findChildren()) {
             Host host = (Host) hostContainer;
-            addContainerListenerIfAbsent(host);
             registerListenersForHost(host);
         }
     }
+
+
     /**
      * Registers listeners on all contexts of the given host.
      *
      * @param host The host to register listeners for
      */
     protected void registerListenersForHost(Host host) {
+        addContainerListenerIfAbsent(host);
         for (Container contextContainer : host.findChildren()) {
             Context context = (Context) contextContainer;
             registerContextListener(context);
         }
     }
 
+
     /**
      * Creates and registers a lifecycle listener for the given context.
      *


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to