This is an automated email from the ASF dual-hosted git repository. michaelo pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 6a58001 Add Javadoc comment about nesting of server-wide listeners 6a58001 is described below commit 6a580010d4f8ffafdc5237402604f91aa1cdd919 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 5a35ce7..3546946 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 d7f6f33..c8d4847 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 b619771..c242eeb 100644 --- a/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java +++ b/java/org/apache/catalina/core/ThreadLocalLeakPreventionListener.java @@ -37,19 +37,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 implements LifecycleListener, ContainerListener { diff --git a/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java b/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java index b298f7e..125d044 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.modeler.Registry; * 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 8ce7802..25dcc73 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