You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2010/07/21 16:15:12 UTC

svn commit: r966230 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java

Author: struberg
Date: Wed Jul 21 14:15:12 2010
New Revision: 966230

URL: http://svn.apache.org/viewvc?rev=966230&view=rev
Log:
OWB-410 lazy init ejbInterceptors Map

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java?rev=966230&r1=966229&r2=966230&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java Wed Jul 21 14:15:12 2010
@@ -49,9 +49,8 @@ public class CreationalContextImpl<T> im
         
     /**Ejb interceptors*/
     //contextual instance --> interceptors
-    private ConcurrentMap<Object, List<EjbInterceptorContext>> ejbInterceptors = 
-            new ConcurrentHashMap<Object, List<EjbInterceptorContext>>();
-    
+    private ConcurrentMap<Object, List<EjbInterceptorContext>> ejbInterceptors = null;
+
     /**When bean object is destroyed it is set*/
     public static ThreadLocal<Object> currentRemoveObject = new ThreadLocal<Object>();
     
@@ -73,7 +72,16 @@ public class CreationalContextImpl<T> im
         Asserts.assertNotNull(ownerInstance,"Owner instance parameter can not be null");
         Asserts.assertNotNull(instance,"Instance parameter can not be null");
         
-        List<EjbInterceptorContext> list = this.ejbInterceptors.get(ownerInstance);
+        List<EjbInterceptorContext> list = null;
+        if (this.ejbInterceptors == null)
+        {
+            this.ejbInterceptors =  new ConcurrentHashMap<Object, List<EjbInterceptorContext>>();
+        }
+        else
+        {
+            list = this.ejbInterceptors.get(ownerInstance);
+        }
+
         if(list == null)
         {
             list = new ArrayList<EjbInterceptorContext>();
@@ -96,6 +104,11 @@ public class CreationalContextImpl<T> im
     public EjbInterceptorContext getEjbInterceptor(Object ownerInstance,Class<?> clazz)
     {
         Asserts.assertNotNull(ownerInstance,"Owner instance can not be null");
+
+        if (this.ejbInterceptors == null)
+        {
+            return null;
+        }
         
         List<EjbInterceptorContext> ejbInterceptors = this.ejbInterceptors.get(ownerInstance);
         if(ejbInterceptors != null)
@@ -315,7 +328,12 @@ public class CreationalContextImpl<T> im
         
         this.dependentObjects.clear();
         
-        Collection<List<EjbInterceptorContext>> interceptorValues = this.ejbInterceptors.values();
+        Collection<List<EjbInterceptorContext>> interceptorValues = null;
+        if (this.ejbInterceptors != null)
+        {
+            this.ejbInterceptors.values();
+        }
+
         if(interceptorValues != null)
         {
             for(List<EjbInterceptorContext> interceptors : interceptorValues)
@@ -328,10 +346,9 @@ public class CreationalContextImpl<T> im
                     }
                 }                
             }
+
+            this.ejbInterceptors.clear();
         }
-        
-        this.ejbInterceptors.clear();
-        
     }
     
     /**