On Wed, May 27, 2026 at 3:24 PM <[email protected]> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> markt-asf pushed a commit to branch 10.1.x
> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>
>
> The following commit(s) were added to refs/heads/10.1.x by this push:
>      new 3e466a953c Add comments
> 3e466a953c is described below
>
> commit 3e466a953cfd84e76b7243274e22c54804debdd6
> Author: remm <[email protected]>
> AuthorDate: Wed May 27 10:15:36 2026 +0200
>
>     Add comments

I did not backport these as they were intended for my LLM (it thinks
it is better to do it the usual way instead; no surprise, it is indeed
better, except for that hotspot). Also since an automatic merge will
always conflict due to the security manager removal. Good to have
them.

Rémy

> ---
>  java/org/apache/catalina/core/StandardHostValve.java | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/java/org/apache/catalina/core/StandardHostValve.java 
> b/java/org/apache/catalina/core/StandardHostValve.java
> index 2da40a4750..4dece1739f 100644
> --- a/java/org/apache/catalina/core/StandardHostValve.java
> +++ b/java/org/apache/catalina/core/StandardHostValve.java
> @@ -50,7 +50,7 @@ final class StandardHostValve extends ValveBase {
>      private static final Log log = 
> LogFactory.getLog(StandardHostValve.class);
>      private static final StringManager sm = 
> StringManager.getManager(StandardHostValve.class);
>
> -    // Saves a call to getClassLoader() on very request. Under high load 
> these
> +    // Saves a call to getClassLoader() on every request. Under high load 
> these
>      // calls took just long enough to appear as a hot spot (although a very
>      // minor one) in a profiler.
>      private static final ClassLoader MY_CLASSLOADER = 
> StandardHostValve.class.getClassLoader();
> @@ -94,6 +94,8 @@ final class StandardHostValve extends ValveBase {
>          boolean asyncAtStart = request.isAsync();
>
>          try {
> +            // No need to check the return value, the original classloader
> +            // will always be considered to be the Catalina one
>              context.bind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);
>
>              if (!asyncAtStart && 
> !context.fireRequestInitEvent(request.getRequest())) {
> @@ -161,6 +163,7 @@ final class StandardHostValve extends ValveBase {
>                  request.getSession(false);
>              }
>
> +            // Always reset the classloader to the Catalina one
>              context.unbind(Globals.IS_SECURITY_ENABLED, MY_CLASSLOADER);
>          }
>      }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>

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

Reply via email to