This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 9a5c21c Add Javadoc comment about nesting of server-wide listeners 9a5c21c is described below commit 9a5c21cb604edd63e28a343f3603e79ab792074b Author: Michael Osipov <micha...@apache.org> AuthorDate: Mon Nov 1 09:18:47 2021 +0100 Add Javadoc comment about nesting of server-wide listeners --- java/org/apache/catalina/core/AprLifecycleListener.java | 3 +++ .../org/apache/catalina/core/JreMemoryLeakPreventionListener.java | 1 + .../apache/catalina/core/ThreadLocalLeakPreventionListener.java | 8 ++------ .../apache/catalina/mbeans/GlobalResourcesLifecycleListener.java | 3 +++ java/org/apache/catalina/security/SecurityListener.java | 4 ++++ java/org/apache/catalina/startup/VersionLoggerListener.java | 4 ++++ webapps/docs/changelog.xml | 4 ++++ 7 files changed, 21 insertions(+), 6 deletions(-) diff --git a/java/org/apache/catalina/core/AprLifecycleListener.java b/java/org/apache/catalina/core/AprLifecycleListener.java index ee2a648..a3bd1db 100644 --- a/java/org/apache/catalina/core/AprLifecycleListener.java +++ b/java/org/apache/catalina/core/AprLifecycleListener.java @@ -25,6 +25,7 @@ import java.util.List; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; +import org.apache.catalina.Server; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jni.Library; @@ -38,6 +39,8 @@ import org.apache.tomcat.util.res.StringManager; /** * Implementation of <code>LifecycleListener</code> that will init and * and destroy APR. + * <p> + * This listener must only be nested within {@link Server} elements. * * @since 4.1 */ diff --git a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java index b3c56a5..12bf11e 100644 --- a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java +++ b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java @@ -33,6 +33,7 @@ import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; import org.apache.catalina.startup.SafeForkJoinWorkerThreadFactory; +import org.apache.catalina.Server; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.ExceptionUtils; diff --git a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java index f13b19a..9000576 100644 --- a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java +++ b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java @@ -34,19 +34,15 @@ import org.apache.tomcat.util.res.StringManager; import org.apache.tomcat.util.threads.ThreadPoolExecutor; /** - * <p> * A {@link LifecycleListener} that triggers the renewal of threads in Executor * pools when a {@link Context} is being stopped to avoid thread-local related * memory leaks. - * </p> * <p> * Note : active threads will be renewed one by one when they come back to the * pool after executing their task, see * {@link org.apache.tomcat.util.threads.ThreadPoolExecutor}.afterExecute(). - * </p> - * - * This listener must be declared in server.xml to be active. - * + * <p> + * This listener must only be nested within {@link Server} elements. */ public class ThreadLocalLeakPreventionListener extends FrameworkListener { diff --git a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java index bca1ed7..d6d7506 100644 --- a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java +++ b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java @@ -31,6 +31,7 @@ import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; import org.apache.catalina.Role; +import org.apache.catalina.Server; import org.apache.catalina.User; import org.apache.catalina.UserDatabase; import org.apache.juli.logging.Log; @@ -42,6 +43,8 @@ import org.apache.tomcat.util.res.StringManager; * Implementation of <code>LifecycleListener</code> that instantiates the * set of MBeans associated with global JNDI resources that are subject to * management. + * <p> + * This listener must only be nested within {@link Server} elements. * * @author Craig R. McClanahan * @since 4.1 diff --git a/java/org/apache/catalina/security/SecurityListener.java b/java/org/apache/catalina/security/SecurityListener.java index 782753f..cee5ae0 100644 --- a/java/org/apache/catalina/security/SecurityListener.java +++ b/java/org/apache/catalina/security/SecurityListener.java @@ -23,11 +23,15 @@ import java.util.Set; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; +import org.apache.catalina.Server; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.buf.StringUtils; import org.apache.tomcat.util.res.StringManager; +/** + * This listener must only be nested within {@link Server} elements. + */ public class SecurityListener implements LifecycleListener { private static final Log log = LogFactory.getLog(SecurityListener.class); diff --git a/java/org/apache/catalina/startup/VersionLoggerListener.java b/java/org/apache/catalina/startup/VersionLoggerListener.java index a4f944b..6ca2ea8 100644 --- a/java/org/apache/catalina/startup/VersionLoggerListener.java +++ b/java/org/apache/catalina/startup/VersionLoggerListener.java @@ -25,6 +25,7 @@ import java.util.TreeMap; import org.apache.catalina.Lifecycle; import org.apache.catalina.LifecycleEvent; import org.apache.catalina.LifecycleListener; +import org.apache.catalina.Server; import org.apache.catalina.util.ServerInfo; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; @@ -32,6 +33,9 @@ import org.apache.tomcat.util.res.StringManager; /** * Logs version information on startup. + * <p> + * This listener must only be nested within {@link Server} elements and should + * be the first listener defined. */ public class VersionLoggerListener implements LifecycleListener { diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 24fa7b0..d6e647c 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -112,6 +112,10 @@ the connection. Also add missing close when running into issues getting the passord of a user. (remm) </fix> + <docs> + Add Javadoc comment which listeners must be nested whithin + <code>Server</code> elements only. (michaelo) + </docs> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org