Author: covener
Date: Mon Mar 8 19:19:31 2010
New Revision: 920463
URL: http://svn.apache.org/viewvc?rev=920463&view=rev
Log:
OWB-318 reuse the interceptor instance when multiple method-level @Interceptors
point to the same class for a given managed bean.
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
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=920463&r1=920462&r2=920463&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
Mon Mar 8 19:19:31 2010
@@ -1122,7 +1122,20 @@
{
if (!isDefinedWithWebBeans)
{
-
intData.setInterceptorInstance(newInstanceForced(clazz));
+ // Check for a duplicate interceptor instance in this
beans stack
+ boolean usedExistingInstance = false;
+ for (InterceptorData idata : stack)
+ {
+ if
(idata.getInterceptorInstance().getClass().equals(clazz))
+ {
+
intData.setInterceptorInstance(idata.getInterceptorInstance());
+ usedExistingInstance = true;
+ }
+ }
+ if (!usedExistingInstance)
+ {
+
intData.setInterceptorInstance(newInstanceForced(clazz));
+ }
}
}
catch (WebBeansConfigurationException e1)
@@ -1221,6 +1234,7 @@
public static <T> T newInstanceForced(Class<T> clazz)
throws WebBeansConfigurationException
{
+ // FIXME: This new instance should have JCDI injection performed
Constructor<T> ct = ClassUtil.isContaintNoArgConstructor(clazz);
if (ct == null)
{