This is an automated email from the ASF dual-hosted git repository.
remm 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 fe797d1417 Expose utility executor to webapps
fe797d1417 is described below
commit fe797d141723bd088825707b85b6c8abc957d012
Author: remm <[email protected]>
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 4e6af40ba0..34bbc4ac2d 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -134,6 +134,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
@@ -4864,6 +4865,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 e084cbd1c3..b5792a67e3 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: [email protected]
For additional commands, e-mail: [email protected]