This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push:
new 27bb36b Use utility executor for scanning
27bb36b is described below
commit 27bb36bdaa56d62fdcc28d3b8e3d4c25f4a44a50
Author: remm
AuthorDate: Fri Sep 18 11:40:17 2020 +0200
Use utility executor for scanning
PR354 submitted by Jatin Kamnani.
The flag in on the context, as that's where it belongs. Defaults to
false, can be configured through the context defaults or per context.
---
java/org/apache/catalina/Context.java | 14 +++
java/org/apache/catalina/core/StandardContext.java | 19
.../apache/catalina/core/mbeans-descriptors.xml| 4 +
.../org/apache/catalina/startup/ContextConfig.java | 116 +
.../org/apache/catalina/startup/FailedContext.java | 5 +
.../catalina/startup/LocalStrings.properties | 1 +
test/org/apache/tomcat/unittest/TesterContext.java | 5 +
webapps/docs/changelog.xml | 4 +
webapps/docs/config/context.xml| 8 ++
9 files changed, 154 insertions(+), 22 deletions(-)
diff --git a/java/org/apache/catalina/Context.java
b/java/org/apache/catalina/Context.java
index b8f55a0..4cf844c 100644
--- a/java/org/apache/catalina/Context.java
+++ b/java/org/apache/catalina/Context.java
@@ -762,6 +762,20 @@ public interface Context extends Container, ContextBind {
public String getContainerSciFilter();
+/**
+ * @return the value of the parallel annotation scanning flag. If true,
+ * it will dispatch scanning to the utility executor.
+ */
+public boolean isParallelAnnotationScanning();
+
+/**
+ * Set the parallel annotation scanning value.
+ *
+ * @param parallelAnnotationScanning new parallel annotation scanning flag
+ */
+public void setParallelAnnotationScanning(boolean
parallelAnnotationScanning);
+
+
// - Public Methods
/**
diff --git a/java/org/apache/catalina/core/StandardContext.java
b/java/org/apache/catalina/core/StandardContext.java
index ce51d6c..a34f14e 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -833,6 +833,8 @@ public class StandardContext extends ContainerBase
private boolean dispatcherWrapsSameObject =
Globals.STRICT_SERVLET_COMPLIANCE;
+private boolean parallelAnnotationScanning = false;
+
// - Context Properties
@Override
@@ -1447,6 +1449,23 @@ public class StandardContext extends ContainerBase
}
+@Override
+public void setParallelAnnotationScanning(boolean
parallelAnnotationScanning) {
+
+boolean oldParallelAnnotationScanning =
this.parallelAnnotationScanning;
+this.parallelAnnotationScanning = parallelAnnotationScanning;
+support.firePropertyChange("parallelAnnotationScanning",
oldParallelAnnotationScanning,
+this.parallelAnnotationScanning);
+
+}
+
+
+@Override
+public boolean isParallelAnnotationScanning() {
+return this.parallelAnnotationScanning;
+}
+
+
/**
* @return the Locale to character set mapper for this Context.
*/
diff --git a/java/org/apache/catalina/core/mbeans-descriptors.xml
b/java/org/apache/catalina/core/mbeans-descriptors.xml
index 1c0733f..50be99f 100644
--- a/java/org/apache/catalina/core/mbeans-descriptors.xml
+++ b/java/org/apache/catalina/core/mbeans-descriptors.xml
@@ -208,6 +208,10 @@
description="The name of this Context"
type="java.lang.String"/>
+
+
diff --git a/java/org/apache/catalina/startup/ContextConfig.java
b/java/org/apache/catalina/startup/ContextConfig.java
index c1fe029..a3cfcb8 100644
--- a/java/org/apache/catalina/startup/ContextConfig.java
+++ b/java/org/apache/catalina/startup/ContextConfig.java
@@ -39,6 +39,8 @@ import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import jakarta.servlet.MultipartConfigElement;
import jakarta.servlet.ServletContainerInitializer;
@@ -122,7 +124,6 @@ public class ContextConfig implements LifecycleListener {
private static final Log log = LogFactory.getLog(ContextConfig.class);
-
/**
* The string resources for this package.
*/
@@ -1374,7 +1375,14 @@ public class ContextConfig implements LifecycleListener {
protected void processClasses(WebXml webXml, Set orderedFragments)
{
// Step 4. Process /WEB-INF/classes for annotations and
// @HandlesTypes matches
-Map javaClassCache = new HashMap<>();
+
+