Author: rmannibucau
Date: Fri Jun 16 11:04:01 2017
New Revision: 1798908
URL: http://svn.apache.org/viewvc?rev=1798908&view=rev
Log:
starting to impl InterceptionFactory
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptionFactoryBean.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptionFactoryImpl.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorProxyChainTest.java
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptionFactoryBean.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptionFactoryBean.java?rev=1798908&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptionFactoryBean.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptionFactoryBean.java
Fri Jun 16 11:04:01 2017
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.component;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.InterceptionFactoryImpl;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.portable.AbstractProducer;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.CollectionUtil;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InterceptionFactory;
+import javax.enterprise.inject.spi.Interceptor;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+public class InterceptionFactoryBean extends
BuiltInOwbBean<InterceptionFactory>
+{
+ public InterceptionFactoryBean(WebBeansContext webBeansContext)
+ {
+ super(webBeansContext,
+ WebBeansType.INTERCEPTIONFACTORY,
+ new BeanAttributesImpl<>(
+
CollectionUtil.<Type>unmodifiableSet(InterceptionFactory.class, Object.class),
+ AnnotationUtil.DEFAULT_AND_ANY_ANNOTATION),
+ InterceptionFactory.class,
+ false,
+ new SimpleProducerFactory<>(new
InterceptionFactoryProducer(webBeansContext)));
+ }
+
+ @Override
+ public boolean isPassivationCapable()
+ {
+ return true;
+ }
+
+ @Override
+ public Class<?> proxyableType()
+ {
+ return InterceptionFactory.class;
+ }
+
+ private static class InterceptionFactoryProducer extends
AbstractProducer<InterceptionFactory<?>>
+ {
+ private final WebBeansContext context;
+
+ private InterceptionFactoryProducer(final WebBeansContext
webBeansContext)
+ {
+ this.context = webBeansContext;
+ }
+
+ @Override
+ protected InterceptionFactory<?> produce(final Map<Interceptor<?>, ?>
interceptorInstances,
+ final
CreationalContextImpl<InterceptionFactory<?>> creationalContext)
+ {
+ final InjectionPoint ip = creationalContext.getInjectionPoint();
+ if (!ParameterizedType.class.isInstance(ip.getType()))
+ {
+ throw new IllegalArgumentException(
+ "No type specified for the interception factory,
ensure to paramterize it");
+ }
+ final ParameterizedType pt =
ParameterizedType.class.cast(ip.getType());
+ if (pt.getActualTypeArguments() == null ||
pt.getActualTypeArguments().length != 1)
+ {
+ throw new IllegalArgumentException("No explicit type specified
for the interception factory");
+ }
+ final Type type = pt.getActualTypeArguments()[0];
+ if (!Class.class.isInstance(type))
+ {
+ throw new IllegalArgumentException("InterceptionFactory only
works with Class, no generics");
+ }
+
+ final AnnotatedType<?> at =
context.getBeanManagerImpl().createAnnotatedType(Class.class.cast(type));
+ return new InterceptionFactoryImpl(context, at,
ip.getQualifiers(), creationalContext);
+ }
+ }
+}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
Fri Jun 16 11:04:01 2017
@@ -73,5 +73,6 @@ public enum WebBeansType
VALIDATION,
METADATA,
SERVLET_CONTEXT,
- SERVLET_REQUEST
+ SERVLET_REQUEST,
+ INTERCEPTIONFACTORY
}
\ No newline at end of file
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Fri Jun 16 11:04:01 2017
@@ -639,6 +639,8 @@ public class BeansDeployer
BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
WebBeansUtil webBeansUtil = webBeansContext.getWebBeansUtil();
+ beanManager.addInternalBean(webBeansUtil.getInterceptionFactoryBean());
+
// Register Conversation built-in component
beanManager.addInternalBean(webBeansUtil.getConversationBean());
Added:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptionFactoryImpl.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptionFactoryImpl.java?rev=1798908&view=auto
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptionFactoryImpl.java
(added)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InterceptionFactoryImpl.java
Fri Jun 16 11:04:01 2017
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.container;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.configurator.AnnotatedTypeConfiguratorImpl;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.intercept.InterceptorResolutionService;
+import org.apache.webbeans.portable.AnnotatedTypeImpl;
+import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
+import org.apache.webbeans.util.WebBeansUtil;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InterceptionFactory;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class InterceptionFactoryImpl<T> implements InterceptionFactory<T>
/*todo: make it serializable*/
+{
+ private final CreationalContextImpl<T> creationalContext;
+ private final AnnotatedTypeConfiguratorImpl<T> configurator;
+ private final Set<Annotation> qualifiers;
+ private final WebBeansContext context;
+ private boolean ignoreFinals;
+
+ public InterceptionFactoryImpl(final WebBeansContext context, final
AnnotatedType<T> at,
+ final Set<Annotation> qualifiers, final
CreationalContextImpl<T> cc)
+ {
+ this.context = context;
+ this.configurator = new AnnotatedTypeConfiguratorImpl<>(context, at);
+ this.qualifiers = qualifiers;
+ this.creationalContext = cc;
+ }
+
+ @Override
+ public InterceptionFactory<T> ignoreFinalMethods()
+ {
+ ignoreFinals = true;
+ return this;
+ }
+
+ @Override
+ public AnnotatedTypeConfigurator<T> configure()
+ {
+ return configurator;
+ }
+
+ @Override
+ public T createInterceptedInstance(final T originalInstance)
+ {
+ ClassLoader classLoader = originalInstance.getClass().getClassLoader();
+ if (classLoader == null)
+ {
+ classLoader = WebBeansUtil.getCurrentClassLoader();
+ }
+
+ final InterceptorDecoratorProxyFactory factory =
context.getInterceptorDecoratorProxyFactory();
+ final AnnotatedTypeImpl<T> newAnnotatedType =
configurator.getNewAnnotatedType();
+ final InterceptorResolutionService.BeanInterceptorInfo interceptorInfo
=
+ context.getInterceptorResolutionService()
+
.calculateInterceptorInfo(newAnnotatedType.getTypeClosure(), qualifiers,
newAnnotatedType, ignoreFinals);
+ final Class<T> subClass = factory.getCachedProxyClass(interceptorInfo,
newAnnotatedType, classLoader);
+
+ final Map<Interceptor<?>,Object> interceptorInstances =
context.getInterceptorResolutionService()
+ .createInterceptorInstances(interceptorInfo,
creationalContext);
+
+ final Map<Method, List<Interceptor<?>>> methodInterceptors =
+
context.getInterceptorResolutionService().createMethodInterceptors(interceptorInfo);
+
+ // this is a good question actually, should we even support it?
+ final String passivationId = InterceptionFactory.class.getName() +
">>" + newAnnotatedType.toString();
+
+ return context.getInterceptorResolutionService().createProxiedInstance(
+ originalInstance, creationalContext, creationalContext,
interceptorInfo, subClass,
+ methodInterceptors, passivationId, interceptorInstances, c ->
false, (a, d) -> d);
+ }
+}
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorResolutionService.java
Fri Jun 16 11:04:01 2017
@@ -26,15 +26,18 @@ import org.apache.webbeans.component.cre
import org.apache.webbeans.config.OpenWebBeansConfiguration;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansDeploymentException;
import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.proxy.InterceptorHandler;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.AnnotatedCallable;
import javax.enterprise.inject.spi.AnnotatedConstructor;
@@ -45,6 +48,7 @@ import javax.enterprise.inject.spi.Decor
import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
import javax.inject.Inject;
+import javax.interceptor.AroundInvoke;
import javax.interceptor.ExcludeClassInterceptors;
import javax.interceptor.Interceptors;
import javax.interceptor.InvocationContext;
@@ -64,6 +68,8 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.BiFunction;
+import java.util.function.Function;
/**
* Class to calculate interceptor resolution information.
@@ -86,7 +92,8 @@ public class InterceptorResolutionServic
}
- public <T> BeanInterceptorInfo calculateInterceptorInfo(Set<Type>
beanTypes, Set<Annotation> qualifiers, AnnotatedType<T> annotatedType)
+ public <T> BeanInterceptorInfo calculateInterceptorInfo(Set<Type>
beanTypes, Set<Annotation> qualifiers, AnnotatedType<T> annotatedType,
+ boolean
allowFinalMethod)
{
Asserts.assertNotNull(beanTypes, "beanTypes");
Asserts.assertNotNull(qualifiers, "qualifiers");
@@ -143,12 +150,12 @@ public class InterceptorResolutionServic
{
BusinessMethodInterceptorInfo methodInterceptorInfo = new
BusinessMethodInterceptorInfo();
- calculateEjbMethodInterceptors(methodInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, annotatedMethod);
+ calculateEjbMethodInterceptors(methodInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, annotatedMethod,
allowFinalMethod);
calculateCdiMethodInterceptors(methodInterceptorInfo,
InterceptionType.AROUND_INVOKE, allUsedCdiInterceptors, annotatedMethod,
- classInterceptorBindings,
classLevelInterceptors);
+ classInterceptorBindings,
classLevelInterceptors, allowFinalMethod);
- calculateCdiMethodDecorators(methodInterceptorInfo, decorators,
annotatedMethod);
+ calculateCdiMethodDecorators(methodInterceptorInfo, decorators,
annotatedMethod, allowFinalMethod);
if (methodInterceptorInfo.isEmpty() && (selfInterceptorBean ==
null || !selfInterceptorBean.isAroundInvoke()))
{
@@ -161,7 +168,7 @@ public class InterceptorResolutionServic
for (AnnotatedConstructor annotatedConstructor :
annotatedType.getConstructors())
{
final BusinessMethodInterceptorInfo constructorInterceptorInfo =
new BusinessMethodInterceptorInfo();
- calculateEjbMethodInterceptors(constructorInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, annotatedConstructor);
+ calculateEjbMethodInterceptors(constructorInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, annotatedConstructor,
allowFinalMethod);
if (constructorInterceptorInfo.isEmpty() && (selfInterceptorBean
== null || !selfInterceptorBean.isAroundInvoke()))
{
continue;
@@ -181,7 +188,8 @@ public class InterceptorResolutionServic
allUsedCdiInterceptors,
allUsedEjbInterceptors,
classLevelEjbInterceptors,
- classInterceptorBindings);
+ classInterceptorBindings,
+ allowFinalMethod);
addLifecycleMethods(
lifecycleMethodInterceptorInfos,
@@ -191,7 +199,8 @@ public class InterceptorResolutionServic
allUsedCdiInterceptors,
allUsedEjbInterceptors,
classLevelEjbInterceptors,
- classInterceptorBindings);
+ classInterceptorBindings,
+ allowFinalMethod);
List<Interceptor<?>> cdiInterceptors = new
ArrayList<Interceptor<?>>(allUsedCdiInterceptors);
Collections.sort(cdiInterceptors, new
InterceptorComparator(webBeansContext));
@@ -215,7 +224,7 @@ public class InterceptorResolutionServic
boolean proxyable = false;
for (AnnotatedConstructor<T> constructor :
annotatedType.getConstructors())
{
- if ((constructor.getParameters().isEmpty() &&
!isUnproxyable(constructor)) ||
+ if ((constructor.getParameters().isEmpty() &&
!isUnproxyable(constructor, allowFinalMethod)) ||
constructor.isAnnotationPresent(Inject.class))
{
proxyable = true;
@@ -343,7 +352,8 @@ public class InterceptorResolutionServic
Set<Interceptor<?>>
allUsedCdiInterceptors,
Set<Interceptor<?>>
allUsedEjbInterceptors,
List<Interceptor<?>>
classLevelEjbInterceptors,
- Set<Annotation> classInterceptorBindings)
+ Set<Annotation> classInterceptorBindings,
+ boolean allowFinal)
{
List<AnnotatedMethod<?>> foundMethods = new
ArrayList<AnnotatedMethod<?>>();
BusinessMethodInterceptorInfo methodInterceptorInfo = new
BusinessMethodInterceptorInfo();
@@ -357,17 +367,17 @@ public class InterceptorResolutionServic
if (lifecycleMethod.getParameters().size() == 0)
{
foundMethods.add(lifecycleMethod);
- calculateEjbMethodInterceptors(methodInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, lifecycleMethod);
+ calculateEjbMethodInterceptors(methodInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, lifecycleMethod, allowFinal);
- calculateCdiMethodInterceptors(methodInterceptorInfo,
interceptionType, allUsedCdiInterceptors, lifecycleMethod,
classInterceptorBindings, null);
+ calculateCdiMethodInterceptors(methodInterceptorInfo,
interceptionType, allUsedCdiInterceptors, lifecycleMethod,
classInterceptorBindings, null, allowFinal);
}
}
for (AnnotatedConstructor<?> lifecycleMethod :
annotatedType.getConstructors())
{
// TODO: verifyLifecycleMethod(lifeycleAnnotation,
lifecycleMethod);
- calculateEjbMethodInterceptors(methodInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, lifecycleMethod);
+ calculateEjbMethodInterceptors(methodInterceptorInfo,
allUsedEjbInterceptors, classLevelEjbInterceptors, lifecycleMethod, allowFinal);
- calculateCdiMethodInterceptors(methodInterceptorInfo,
interceptionType, allUsedCdiInterceptors, lifecycleMethod,
classInterceptorBindings, null);
+ calculateCdiMethodInterceptors(methodInterceptorInfo,
interceptionType, allUsedCdiInterceptors, lifecycleMethod,
classInterceptorBindings, null, allowFinal);
}
if (foundMethods.size() > 0 )
@@ -405,9 +415,10 @@ public class InterceptorResolutionServic
}
private void calculateEjbMethodInterceptors(BusinessMethodInterceptorInfo
methodInterceptorInfo, Set<Interceptor<?>> allUsedEjbInterceptors,
- List<Interceptor<?>>
classLevelEjbInterceptors, AnnotatedCallable annotatedMethod)
+ List<Interceptor<?>>
classLevelEjbInterceptors, AnnotatedCallable annotatedMethod,
+ boolean allowFinal)
{
- boolean unproxyable = isUnproxyable(annotatedMethod);
+ boolean unproxyable = isUnproxyable(annotatedMethod, allowFinal);
List<Interceptor<?>> methodInterceptors = new
ArrayList<Interceptor<?>>();
@@ -432,14 +443,15 @@ public class InterceptorResolutionServic
}
}
- private boolean isUnproxyable(AnnotatedCallable annotatedMethod)
+ private boolean isUnproxyable(AnnotatedCallable annotatedMethod, boolean
allowFinal)
{
int modifiers = annotatedMethod.getJavaMember().getModifiers();
- return Modifier.isFinal(modifiers) || Modifier.isPrivate(modifiers);
+ return (!allowFinal && Modifier.isFinal(modifiers)) ||
Modifier.isPrivate(modifiers);
}
- private void calculateCdiMethodDecorators(BusinessMethodInterceptorInfo
methodInterceptorInfo, List<Decorator<?>> decorators, AnnotatedMethod
annotatedMethod)
+ private void calculateCdiMethodDecorators(BusinessMethodInterceptorInfo
methodInterceptorInfo, List<Decorator<?>> decorators, AnnotatedMethod
annotatedMethod,
+ boolean allowFinal)
{
if (decorators == null || decorators.isEmpty())
{
@@ -458,7 +470,7 @@ public class InterceptorResolutionServic
Method decoratingMethod = getDecoratingMethod(decorator,
annotatedMethod);
if (decoratingMethod != null)
{
- if (isUnproxyable(annotatedMethod))
+ if (isUnproxyable(annotatedMethod, allowFinal))
{
throw new WebBeansDeploymentException(annotatedMethod + "
is not proxyable, but an Decorator got defined on it!");
}
@@ -579,11 +591,12 @@ public class InterceptorResolutionServic
Set<Interceptor<?>>
allUsedCdiInterceptors,
AnnotatedCallable
annotatedMethod,
Set<Annotation>
classInterceptorBindings,
- List<Interceptor<?>>
classLevelInterceptors)
+ List<Interceptor<?>>
classLevelInterceptors,
+ boolean allowFinal)
{
AnnotationManager annotationManager =
webBeansContext.getAnnotationManager();
- boolean unproxyable = isUnproxyable(annotatedMethod);
+ boolean unproxyable = isUnproxyable(annotatedMethod, allowFinal);
boolean hasMethodInterceptors = false;
Map<Class<? extends Annotation>, Annotation>
cummulatedInterceptorBindings = new HashMap<Class<? extends Annotation>,
Annotation>();
@@ -741,6 +754,109 @@ public class InterceptorResolutionServic
return interceptableAnnotatedMethods;
}
+ public Map<Method, List<Interceptor<?>>> createMethodInterceptors(final
BeanInterceptorInfo interceptorInfo)
+ {
+ final Map<Method, List<Interceptor<?>>> methodInterceptors = new
HashMap<>(interceptorInfo.getBusinessMethodsInfo().size());
+ for (Map.Entry<Method, BusinessMethodInterceptorInfo> miEntry :
interceptorInfo.getBusinessMethodsInfo().entrySet())
+ {
+ Method interceptedMethod = miEntry.getKey();
+ BusinessMethodInterceptorInfo mii = miEntry.getValue();
+ List<Interceptor<?>> activeInterceptors = new ArrayList<>();
+
+ if (mii.getEjbInterceptors() != null)
+ {
+ Collections.addAll(activeInterceptors,
mii.getEjbInterceptors());
+ }
+ if (mii.getCdiInterceptors() != null)
+ {
+ Collections.addAll(activeInterceptors,
mii.getCdiInterceptors());
+ }
+ if (interceptorInfo.getSelfInterceptorBean() != null)
+ {
+ if (interceptedMethod.getAnnotation(AroundInvoke.class) ==
null) // this check is a dirty hack for now to prevent infinite loops
+ {
+ // add self-interception as last interceptor in the chain.
+
activeInterceptors.add(interceptorInfo.getSelfInterceptorBean());
+ }
+ }
+
+ if (activeInterceptors.size() > 0)
+ {
+ methodInterceptors.put(interceptedMethod, activeInterceptors);
+ }
+ else if (mii.getMethodDecorators() != null)
+ {
+ methodInterceptors.put(interceptedMethod,
Collections.EMPTY_LIST);
+ }
+ }
+ return methodInterceptors;
+ }
+
+ public <T> Map<Interceptor<?>, Object> createInterceptorInstances(final
BeanInterceptorInfo interceptorInfo,
+ final
CreationalContextImpl<T> creationalContextImpl)
+ {
+ final Map<Interceptor<?>,Object> interceptorInstances = new
HashMap<>();
+ if (interceptorInfo != null)
+ {
+ // apply interceptorInfo
+
+ // create EJB-style interceptors
+ for (final Interceptor interceptorBean :
interceptorInfo.getEjbInterceptors())
+ {
+ creationalContextImpl.putContextual(interceptorBean);
+ interceptorInstances.put(interceptorBean,
interceptorBean.create(creationalContextImpl));
+ }
+
+ // create CDI-style interceptors
+ for (final Interceptor interceptorBean :
interceptorInfo.getCdiInterceptors())
+ {
+ creationalContextImpl.putContextual(interceptorBean);
+ interceptorInstances.put(interceptorBean,
interceptorBean.create(creationalContextImpl));
+ }
+ for (final Interceptor interceptorBean :
interceptorInfo.getConstructorCdiInterceptors())
+ {
+ creationalContextImpl.putContextual(interceptorBean);
+ interceptorInstances.put(interceptorBean,
interceptorBean.create(creationalContextImpl));
+ }
+ }
+ return interceptorInstances;
+ }
+
+ public <T> T createProxiedInstance(final T instance, final
CreationalContextImpl<T> creationalContextImpl,
+ final CreationalContext<T>
creationalContext,
+ final BeanInterceptorInfo
interceptorInfo,
+ final Class<? extends T> proxyClass,
final Map<Method, List<Interceptor<?>>> methodInterceptors,
+ final String passivationId, final
Map<Interceptor<?>, Object> interceptorInstances,
+ final
Function<CreationalContextImpl<?>, Boolean> isDelegateInjection,
+ final BiFunction<T, List<Decorator<?>>,
List<Decorator<?>>> filterDecorators)
+ {
+ // register the bean itself for self-interception
+ if (interceptorInfo.getSelfInterceptorBean() != null)
+ {
+ interceptorInstances.put(interceptorInfo.getSelfInterceptorBean(),
instance);
+ }
+
+ T delegate = instance;
+ if (interceptorInfo.getDecorators() != null &&
!isDelegateInjection.apply(creationalContextImpl))
+ {
+ List<Decorator<?>> decorators = filterDecorators.apply(instance,
interceptorInfo.getDecorators());
+ Map<Decorator<?>, Object> instances = new HashMap<Decorator<?>,
Object>();
+ for (int i = decorators.size(); i > 0; i--)
+ {
+ Decorator decorator = decorators.get(i - 1);
+ creationalContextImpl.putContextual(decorator);
+ creationalContextImpl.putDelegate(delegate);
+ Object decoratorInstance = decorator.create(creationalContext);
+ instances.put(decorator, decoratorInstance);
+ delegate =
webBeansContext.getInterceptorDecoratorProxyFactory().createProxyInstance(proxyClass,
instance,
+ new DecoratorHandler(interceptorInfo, decorators,
instances, i - 1, instance, passivationId));
+ }
+ }
+ InterceptorHandler interceptorHandler = new
DefaultInterceptorHandler<>(instance, delegate, methodInterceptors,
interceptorInstances, passivationId);
+
+ return
webBeansContext.getInterceptorDecoratorProxyFactory().createProxyInstance(proxyClass,
instance, interceptorHandler);
+ }
+
/**
* static information about interceptors and decorators for a
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/AbstractProducer.java
Fri Jun 16 11:04:01 2017
@@ -19,9 +19,7 @@
package org.apache.webbeans.portable;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -36,17 +34,12 @@ import javax.enterprise.inject.spi.Injec
import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.inject.spi.PassivationCapable;
import javax.enterprise.inject.spi.Producer;
-import javax.interceptor.AroundInvoke;
import org.apache.webbeans.component.BeanManagerBean;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.context.creational.CreationalContextImpl;
-import org.apache.webbeans.intercept.DecoratorHandler;
-import org.apache.webbeans.intercept.DefaultInterceptorHandler;
import
org.apache.webbeans.intercept.InterceptorResolutionService.BeanInterceptorInfo;
-import
org.apache.webbeans.intercept.InterceptorResolutionService.BusinessMethodInterceptorInfo;
import org.apache.webbeans.proxy.InterceptorDecoratorProxyFactory;
-import org.apache.webbeans.proxy.InterceptorHandler;
import org.apache.webbeans.proxy.OwbInterceptorProxy;
public abstract class AbstractProducer<T> implements Producer<T>
@@ -87,7 +80,7 @@ public abstract class AbstractProducer<T
}
interceptorInfo = webBeansContext.getInterceptorResolutionService().
- calculateInterceptorInfo(bean.getTypes(),
bean.getQualifiers(), annotatedType);
+ calculateInterceptorInfo(bean.getTypes(),
bean.getQualifiers(), annotatedType, false);
proxyFactory = webBeansContext.getInterceptorDecoratorProxyFactory();
if (bean instanceof PassivationCapable)
{
@@ -95,39 +88,7 @@ public abstract class AbstractProducer<T
passivationId = passivationCapable.getId();
}
- methodInterceptors = new HashMap<Method, List<Interceptor<?>>>();
- for (Map.Entry<Method, BusinessMethodInterceptorInfo> miEntry :
interceptorInfo.getBusinessMethodsInfo().entrySet())
- {
- Method interceptedMethod = miEntry.getKey();
- BusinessMethodInterceptorInfo mii = miEntry.getValue();
- List<Interceptor<?>> activeInterceptors = new
ArrayList<Interceptor<?>>();
-
- if (mii.getEjbInterceptors() != null)
- {
- Collections.addAll(activeInterceptors,
mii.getEjbInterceptors());
- }
- if (mii.getCdiInterceptors() != null)
- {
- Collections.addAll(activeInterceptors,
mii.getCdiInterceptors());
- }
- if (interceptorInfo.getSelfInterceptorBean() != null)
- {
- if (interceptedMethod.getAnnotation(AroundInvoke.class) ==
null) // this check is a dirty hack for now to prevent infinite loops
- {
- // add self-interception as last interceptor in the chain.
-
activeInterceptors.add(interceptorInfo.getSelfInterceptorBean());
- }
- }
-
- if (activeInterceptors.size() > 0)
- {
- methodInterceptors.put(interceptedMethod, activeInterceptors);
- }
- else if (mii.getMethodDecorators() != null)
- {
- methodInterceptors.put(interceptedMethod,
Collections.EMPTY_LIST);
- }
- }
+ methodInterceptors =
webBeansContext.getInterceptorResolutionService().createMethodInterceptors(interceptorInfo);
defineLifecycleInterceptors(bean, annotatedType, webBeansContext);
@@ -147,7 +108,7 @@ public abstract class AbstractProducer<T
}
}
-
+
@Override
public Set<InjectionPoint> getInjectionPoints()
{
@@ -166,74 +127,24 @@ public abstract class AbstractProducer<T
final Contextual<T> oldContextual =
creationalContextImpl.getContextual();
- final Map<Interceptor<?>, Object> interceptorInstances =
createInterceptorInstances(creationalContextImpl);
+ final Map<Interceptor<?>, Object> interceptorInstances =
creationalContextImpl.getWebBeansContext()
+
.getInterceptorResolutionService().createInterceptorInstances(interceptorInfo,
creationalContextImpl);
creationalContextImpl.putContextual(oldContextual);
T instance = produce(interceptorInstances, creationalContextImpl);
if (hasInterceptorInfo())
{
- // register the bean itself for self-interception
- if (interceptorInfo.getSelfInterceptorBean() != null)
- {
-
interceptorInstances.put(interceptorInfo.getSelfInterceptorBean(), instance);
- }
-
- T delegate = instance;
- if (interceptorInfo.getDecorators() != null &&
!isDelegateInjection(creationalContextImpl))
- {
- List<Decorator<?>> decorators = filterDecorators(instance,
interceptorInfo.getDecorators());
- Map<Decorator<?>, Object> instances = new
HashMap<Decorator<?>, Object>();
- for (int i = decorators.size(); i > 0; i--)
- {
- Decorator decorator = decorators.get(i - 1);
- creationalContextImpl.putContextual(decorator);
- creationalContextImpl.putDelegate(delegate);
- Object decoratorInstance =
decorator.create(creationalContext);
- instances.put(decorator, decoratorInstance);
- delegate = proxyFactory.createProxyInstance(proxyClass,
instance,
- new DecoratorHandler(interceptorInfo, decorators,
instances, i - 1, instance, passivationId));
- }
- }
- InterceptorHandler interceptorHandler = new
DefaultInterceptorHandler<T>(instance, delegate, methodInterceptors,
interceptorInstances, passivationId);
-
- T proxyInstance = proxyFactory.createProxyInstance(proxyClass,
instance, interceptorHandler);
- instance = proxyInstance;
+ instance =
creationalContextImpl.getWebBeansContext().getInterceptorResolutionService()
+ .createProxiedInstance(instance, creationalContextImpl,
creationalContext,
+ interceptorInfo, proxyClass, methodInterceptors,
passivationId, interceptorInstances,
+ this::isDelegateInjection, this::filterDecorators);
creationalContextImpl.putContextual(oldContextual);
}
return instance;
}
- protected Map<Interceptor<?>, Object>
createInterceptorInstances(CreationalContextImpl<T> creationalContextImpl)
- {
- final Map<Interceptor<?>,Object> interceptorInstances = new
HashMap<Interceptor<?>, Object>();
- if (interceptorInfo != null)
- {
- // apply interceptorInfo
-
- // create EJB-style interceptors
- for (final Interceptor interceptorBean :
interceptorInfo.getEjbInterceptors())
- {
- creationalContextImpl.putContextual(interceptorBean);
- interceptorInstances.put(interceptorBean,
interceptorBean.create(creationalContextImpl));
- }
-
- // create CDI-style interceptors
- for (final Interceptor interceptorBean :
interceptorInfo.getCdiInterceptors())
- {
- creationalContextImpl.putContextual(interceptorBean);
- interceptorInstances.put(interceptorBean,
interceptorBean.create(creationalContextImpl));
- }
- for (final Interceptor interceptorBean :
interceptorInfo.getConstructorCdiInterceptors())
- {
- creationalContextImpl.putContextual(interceptorBean);
- interceptorInstances.put(interceptorBean,
interceptorBean.create(creationalContextImpl));
- }
- }
- return interceptorInstances;
- }
-
protected List<Decorator<?>> filterDecorators(final T instance, final
List<Decorator<?>> decorators)
{
return decorators;
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java
Fri Jun 16 11:04:01 2017
@@ -22,6 +22,7 @@ package org.apache.webbeans.proxy;
import org.apache.webbeans.config.WebBeansContext;
import org.apache.webbeans.exception.ProxyGenerationException;
import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.intercept.InterceptorResolutionService;
import org.apache.webbeans.logger.WebBeansLoggerFacade;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ExceptionUtil;
@@ -31,17 +32,18 @@ import org.apache.xbean.asm5.MethodVisit
import org.apache.xbean.asm5.Opcodes;
import org.apache.xbean.asm5.Type;
+import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.Bean;
import java.io.ObjectStreamException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.logging.Logger;
-
/**
* Generate a dynamic subclass which has exactly 1 delegation point instance
* which get's set in the Constructor of the proxy.
@@ -69,7 +71,8 @@ public class InterceptorDecoratorProxyFa
* Caches the proxy classes for each bean.
* We need this to prevent filling up the ClassLoaders by
*/
- private ConcurrentMap<Bean<?>, Class<?>> cachedProxyClasses = new
ConcurrentHashMap<Bean<?>, Class<?>>();
+ private ConcurrentMap<Bean<?>, Class<?>> cachedProxyClasses = new
ConcurrentHashMap<>();
+ private ConcurrentMap<AnnotatedType<?>, Class<?>> cachedProxyClassesByAt =
new ConcurrentHashMap<>();
public InterceptorDecoratorProxyFactory(WebBeansContext webBeansContext)
@@ -182,6 +185,29 @@ public class InterceptorDecoratorProxyFa
Method[]
interceptedMethods, Method[] nonInterceptedMethods)
throws ProxyGenerationException
{
+ Class<T> proxyClass = createProxyClass(classLoader, classToProxy,
interceptedMethods, nonInterceptedMethods);
+ cachedProxyClasses.put(bean, proxyClass);
+ return proxyClass;
+ }
+
+ public synchronized <T> Class<T> createProxyClass(final
InterceptorResolutionService.BeanInterceptorInfo interceptorInfo,
+ final AnnotatedType<T>
at, final ClassLoader classLoader)
+ throws ProxyGenerationException
+ {
+ final Collection<Method> intercepted =
interceptorInfo.getBusinessMethodsInfo().keySet();
+ final Collection<Method> others =
interceptorInfo.getNonInterceptedMethods();
+
+ final Class<T> proxyClass = createProxyClass(
+ classLoader, at.getJavaClass(),
+ intercepted.toArray(new Method[intercepted.size()]),
others.toArray(new Method[others.size()]));
+ cachedProxyClassesByAt.put(at, proxyClass);
+ return proxyClass;
+ }
+
+ private <T> Class<T> createProxyClass(ClassLoader classLoader, Class<T>
classToProxy,
+ Method[] interceptedMethods,
Method[] nonInterceptedMethods)
+ throws ProxyGenerationException
+ {
String proxyClassName = getUnusedProxyClassName(classLoader,
classToProxy.getName() + "$$OwbInterceptProxy");
@@ -198,11 +224,20 @@ public class InterceptorDecoratorProxyFa
throw new ProxyGenerationException(e);
}
- cachedProxyClasses.put(bean, clazz);
-
return clazz;
}
+ public <T> Class<T> getCachedProxyClass(final
InterceptorResolutionService.BeanInterceptorInfo interceptorInfo,
+ final AnnotatedType<T> at, final
ClassLoader classLoader)
+ {
+ Class<T> value = (Class<T>) cachedProxyClassesByAt.get(at);
+ if (value == null)
+ {
+ value = createProxyClass(interceptorInfo, at, classLoader);
+ }
+ return value;
+ }
+
public <T> Class<T> getCachedProxyClass(Bean<T> bean)
{
return (Class<T>) cachedProxyClasses.get(bean);
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/SubclassProxyFactory.java
Fri Jun 16 11:04:01 2017
@@ -64,6 +64,7 @@ public class SubclassProxyFactory extend
}
+ // todo: using a cache is faster (no synchronized)
Class<T> proxyClass = tryToLoadClass(classLoader, classToProxy);
if (proxyClass != null)
{
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Fri Jun 16 11:04:01 2017
@@ -36,6 +36,7 @@ import org.apache.webbeans.component.Inj
import org.apache.webbeans.component.InjectionTargetBean;
import org.apache.webbeans.component.InstanceBean;
import org.apache.webbeans.component.InterceptedOrDecoratedBeanMetadataBean;
+import org.apache.webbeans.component.InterceptionFactoryBean;
import org.apache.webbeans.component.InterceptorMetadataBean;
import org.apache.webbeans.component.ManagedBean;
import org.apache.webbeans.component.NewManagedBean;
@@ -1930,6 +1931,11 @@ public final class WebBeansUtil
}
}
+ public InterceptionFactoryBean getInterceptionFactoryBean()
+ {
+ return new InterceptionFactoryBean(webBeansContext);
+ }
+
private static final class EventCacheKey
{
Modified:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorProxyChainTest.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorProxyChainTest.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorProxyChainTest.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorProxyChainTest.java
Fri Jun 16 11:04:01 2017
@@ -76,7 +76,7 @@ public class InterceptorProxyChainTest e
AnnotatedType<ClassMultiInterceptedClass> annotatedType =
getBeanManager().createAnnotatedType(ClassMultiInterceptedClass.class);
Bean<ClassMultiInterceptedClass> bean =
(Bean<ClassMultiInterceptedClass>)
getBeanManager().resolve(getBeanManager().getBeans(ClassMultiInterceptedClass.class));
- InterceptorResolutionService.BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ InterceptorResolutionService.BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Modified:
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java?rev=1798908&r1=1798907&r2=1798908&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/interceptors/resolution/InterceptorResolutionServiceTest.java
Fri Jun 16 11:04:01 2017
@@ -86,7 +86,7 @@ public class InterceptorResolutionServic
Bean<ClassInterceptedClass> bean =
(Bean<ClassInterceptedClass>) getBeanManager().resolve((Set)
getBeanManager().getBeans(ClassInterceptedClass.class));
- BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
@@ -129,7 +129,7 @@ public class InterceptorResolutionServic
Bean<StereotypeInterceptedClass> bean =
(Bean<StereotypeInterceptedClass>)
getBeanManager().resolve((Set)
getBeanManager().getBeans(StereotypeInterceptedClass.class));
- BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
@@ -165,7 +165,7 @@ public class InterceptorResolutionServic
for (int i=0; i < 2; i++)
{
// for being able to do some cheap performance tests
- interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(),
bean.getQualifiers(), annotatedType);
+ interceptorInfo = ir.calculateInterceptorInfo(bean.getTypes(),
bean.getQualifiers(), annotatedType, false);
}
long end = System.nanoTime();
log.info("calculating the interceptor info took " +
TimeUnit.NANOSECONDS.toMillis(end-start) + " ms");
@@ -218,7 +218,7 @@ public class InterceptorResolutionServic
Bean<MethodInterceptedClass> bean =
(Bean<MethodInterceptedClass>) getBeanManager().resolve((Set)
getBeanManager().getBeans(MethodInterceptedClass.class));
- BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Assert.assertNotNull(interceptorInfo.getCdiInterceptors());
@@ -265,7 +265,7 @@ public class InterceptorResolutionServic
Bean<DecoratedClass> bean =
(Bean<DecoratedClass>) getBeanManager().resolve((Set)
getBeanManager().getBeans(DecoratedClass.class, new
AnnotationLiteral<Binding1>() {}));
- BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
@@ -295,7 +295,7 @@ public class InterceptorResolutionServic
Bean<Cow> bean = (Bean<Cow>) getBeanManager().resolve((Set)
getBeanManager().getBeans(Cow.class));
Assert.assertNotNull(bean);
- BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
@@ -323,7 +323,7 @@ public class InterceptorResolutionServic
Bean<InterceptedComponent> bean
= (Bean<InterceptedComponent>) getBeanManager().resolve((Set)
getBeanManager().getBeans(InterceptedComponent.class));
- BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType);
+ BeanInterceptorInfo interceptorInfo =
ir.calculateInterceptorInfo(bean.getTypes(), bean.getQualifiers(),
annotatedType, false);
Assert.assertNotNull(interceptorInfo);
Assert.assertNotNull(interceptorInfo.getBusinessMethodsInfo());
Assert.assertEquals(2,
interceptorInfo.getBusinessMethodsInfo().size());