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

markt-asf 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 7d520f75a0 Add comments
7d520f75a0 is described below

commit 7d520f75a0afd93825b28b96fcdd8c51a73f8ac4
Author: remm <[email protected]>
AuthorDate: Wed May 27 10:15:36 2026 +0200

    Add comments
---
 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 d587cf5bea..31a7521e09 100644
--- a/java/org/apache/catalina/core/StandardHostValve.java
+++ b/java/org/apache/catalina/core/StandardHostValve.java
@@ -49,7 +49,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();
@@ -108,6 +108,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())) {
@@ -175,6 +177,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]

Reply via email to