This is an automated email from the ASF dual-hosted git repository.
rmannibucau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 42524ee [OWB-1361] startup time improvements: enable to skip our
noclassdeffound checks - in well known cases, enable to skip some cdi
validations - once deployment is validated it helps, skip anonymous and private
classes earlier in the process, enable to skip PAT event when there is no
observer for it (todo: same for PIP)
42524ee is described below
commit 42524ee28e0fc2ed63ed9edb99c31edd9aca2674
Author: Romain Manni-Bucau
AuthorDate: Sat Dec 26 18:37:19 2020 +0100
[OWB-1361] startup time improvements: enable to skip our noclassdeffound
checks - in well known cases, enable to skip some cdi validations - once
deployment is validated it helps, skip anonymous and private classes earlier in
the process, enable to skip PAT event when there is no observer for it (todo:
same for PIP)
---
.../org/apache/webbeans/config/BeansDeployer.java | 35 ++-
.../webbeans/config/OpenWebBeansConfiguration.java | 6 +
.../corespi/scanner/AbstractMetaDataDiscovery.java | 14 +-
.../apache/webbeans/event/NotificationManager.java | 309 +++--
.../webbeans/portable/AnnotatedElementFactory.java | 2 +-
.../java/org/apache/webbeans/util/ClassUtil.java | 10 +-
6 files changed, 215 insertions(+), 161 deletions(-)
diff --git
a/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
b/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
index a7b2337..5eaf2c3 100644
--- a/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
+++ b/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
@@ -111,6 +111,7 @@ import javax.enterprise.inject.spi.Producer;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URL;
@@ -164,6 +165,8 @@ public class BeansDeployer
private final Map packageVetoCache = new HashMap<>();
protected boolean skipVetoedOnPackages;
+protected boolean skipNoClassDefFoundTriggers;
+protected boolean skipValidations;
/**
* This BdaInfo is used for all manually added annotated types or in case
@@ -188,6 +191,9 @@ public class BeansDeployer
discoverEjb = Boolean.parseBoolean(usage);
skipVetoedOnPackages =
Boolean.parseBoolean(this.webBeansContext.getOpenWebBeansConfiguration().getProperty(
"org.apache.webbeans.spi.deployer.skipVetoedOnPackages"));
+skipValidations =
Boolean.parseBoolean(this.webBeansContext.getOpenWebBeansConfiguration().getProperty(
+"org.apache.webbeans.spi.deployer.skipValidations"));
+skipNoClassDefFoundTriggers =
this.webBeansContext.getOpenWebBeansConfiguration().isSkipNoClassDefFoundErrorTriggers();
defaultBeanArchiveInformation = new
DefaultBeanArchiveInformation("default");
defaultBeanArchiveInformation.setBeanDiscoveryMode(BeanDiscoveryMode.ALL);
@@ -313,15 +319,18 @@ public class BeansDeployer
// drop no more needed memory data
webBeansContext.getNotificationManager().afterStart();
-validateAlternatives(beanAttributesPerBda);
+if (!skipValidations)
+{
+validateAlternatives(beanAttributesPerBda);
-validateInjectionPoints();
-validateDisposeParameters();
+validateInjectionPoints();
+validateDisposeParameters();
-validateDecoratorDecoratedTypes();
-validateDecoratorGenericTypes();
+validateDecoratorDecoratedTypes();
+validateDecoratorGenericTypes();
-validateNames();
+validateNames();
+}
if
(webBeansContext.getNotificationManager().getObserverMethods().stream()
.anyMatch(ObserverMethod::isAsync))
@@ -1295,10 +1304,11 @@ public class BeansDeployer
if (classIndex != null)
{
AnnotatedElementFactory annotatedElementFactory =
webBeansContext.getAnnotatedElementFactory();
-
+boolean hasPATObserver =
webBeansContext.getNotificationManager().hasProcessAnnotatedTypeObservers();
for (Class implClass : classIndex)
{
-if (foundClasses.contains(implClass))
+if (foundClasses.contains(implClass) ||
implClass.isAnonymousClass() ||
+Modifier.isPrivate(implClass.getModifiers() /* likely
inner class */))
{
// skip this class