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

remm 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 4e3972d33d Expose utility executor to webapps
4e3972d33d is described below

commit 4e3972d33d38c14e8de26240f4d13675273c4e81
Author: remm <r...@apache.org>
AuthorDate: Tue Apr 11 10:10:04 2023 +0200

    Expose utility executor to webapps
    
    Part of the discussions in PR#607
    Only enabled when the security manager is not active.
---
 java/org/apache/catalina/core/StandardContext.java | 7 +++++++
 webapps/docs/changelog.xml                         | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/java/org/apache/catalina/core/StandardContext.java 
b/java/org/apache/catalina/core/StandardContext.java
index 6a7a03bcb0..5dbeae925c 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -135,6 +135,7 @@ import org.apache.tomcat.util.http.Rfc6265CookieProcessor;
 import org.apache.tomcat.util.scan.StandardJarScanner;
 import org.apache.tomcat.util.security.PrivilegedGetTccl;
 import org.apache.tomcat.util.security.PrivilegedSetTccl;
+import org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor;
 
 /**
  * Standard implementation of the <b>Context</b> interface. Each child 
container must be a Wrapper implementation to
@@ -4918,6 +4919,12 @@ public class StandardContext extends ContainerBase 
implements Context, Notificat
 
                 // Make the version info available
                 getServletContext().setAttribute(Globals.WEBAPP_VERSION, 
getWebappVersion());
+
+                // Make the utility executor available
+                if (!Globals.IS_SECURITY_ENABLED) {
+                    
getServletContext().setAttribute(ScheduledThreadPoolExecutor.class.getName(),
+                            
Container.getService(this).getServer().getUtilityExecutor());
+                }
             }
 
             // Set up the context init params
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 60626d2702..7d4dd421f0 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -175,6 +175,11 @@
         avoid possible JVM thread creation in the webapp context on some
         platforms. (remm)
       </fix>
+      <update>
+        Make the server utility executor available to webapps using a Servlet
+        context attribute named
+        
<code>org.apache.tomcat.util.threads.ScheduledThreadPoolExecutor</code>. (remm)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Coyote">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to