openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1077893 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ManagedBean.java config/DefinitionUtil.java
Date Fri, 04 Mar 2011 12:04:21 GMT
Author: struberg
Date: Fri Mar  4 12:04:20 2011
New Revision: 1077893

URL: http://svn.apache.org/viewvc?rev=1077893&view=rev
Log:
OWB-538 don't define interceptor stack twice

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java?rev=1077893&r1=1077892&r2=1077893&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
Fri Mar  4 12:04:20 2011
@@ -55,7 +55,7 @@ public class ManagedBean<T> extends Abst
      * beans which only could picked up as auto-&#0064;Dependent beans which
      * do not register/ any other beans (e.g. via &#0064;Produces)
      */
-    private boolean fullInit = true;
+    private volatile boolean fullInit = true;
 
 
     public ManagedBean(Class<T> returnType, WebBeansContext webBeansContext)
@@ -86,11 +86,7 @@ public class ManagedBean<T> extends Abst
     {
         if (!fullInit)
         {
-            ManagedBeanCreatorImpl<T> managedBeanCreator = new ManagedBeanCreatorImpl<T>(this);
-            managedBeanCreator.setAnnotatedType(getAnnotatedType());
-
-            getWebBeansContext().getWebBeansUtil().lazyInitializeManagedBean(getBeanClass(),
this, managedBeanCreator);
-            fullInit = true;
+            lazyInit();
         }
 
 
@@ -108,6 +104,18 @@ public class ManagedBean<T> extends Abst
         return instance;
     }
 
+    private synchronized void lazyInit()
+    {
+        if (!fullInit)
+        {
+            fullInit = true;
+            ManagedBeanCreatorImpl<T> managedBeanCreator = new ManagedBeanCreatorImpl<T>(this);
+            managedBeanCreator.setAnnotatedType(getAnnotatedType());
+
+            getWebBeansContext().getWebBeansUtil().lazyInitializeManagedBean(getBeanClass(),
this, managedBeanCreator);
+        }
+    }
+
     public boolean isFullInit()
     {
         return fullInit;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1077893&r1=1077892&r2=1077893&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
Fri Mar  4 12:04:20 2011
@@ -1140,6 +1140,11 @@ public final class DefinitionUtil
     public static void defineBeanInterceptorStack(AbstractInjectionTargetBean<?> bean)
     {
         Asserts.assertNotNull(bean, "bean parameter can no be null");
+        if (!bean.getInterceptorStack().isEmpty())
+        {
+            // the interceptorstack already got defined!
+            return;
+        }
 
         // If bean is not session bean
         if(!(bean instanceof EnterpriseBeanMarker))



Mime
View raw message