openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1080771 - /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
Date Fri, 11 Mar 2011 21:47:41 GMT
Author: struberg
Date: Fri Mar 11 21:47:40 2011
New Revision: 1080771

URL: http://svn.apache.org/viewvc?rev=1080771&view=rev
Log:
OWB-530 add further synchronization

we should try to implement this via ReentrantReadWriteLock
after getting some performance data.

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=1080771&r1=1080770&r2=1080771&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
Fri Mar 11 21:47:40 2011
@@ -175,6 +175,7 @@ public class CreationalContextImpl<T> im
 
             dependentCreational.setInstance(instance);
 
+            //X TODO maybe better with ReentrantReadWriteLock?
             synchronized(this)
             {
                 if (dependentObjects == null)
@@ -208,22 +209,25 @@ public class CreationalContextImpl<T> im
             return null;
         }
 
-        List<DependentCreationalContext<?>> values = this.dependentObjects.get(ownerInstance);
-        if(values != null && !values.isEmpty())
+        //X TODO maybe better with ReentrantReadWriteLock?
+        synchronized(this)
         {
-            Iterator<DependentCreationalContext<?>> it = values.iterator();
-            while(it.hasNext())
+            List<DependentCreationalContext<?>> values = this.dependentObjects.get(ownerInstance);
+            if(values != null && !values.isEmpty())
             {
-                DependentCreationalContext<?> dc = it.next();
-                if(dc.getDependentType().equals(DependentType.INTERCEPTOR) &&
-                   dc.getContextual().equals(interceptor))
+                Iterator<DependentCreationalContext<?>> it = values.iterator();
+                while(it.hasNext())
                 {
-                    return dc.getInstance();
-                }
+                    DependentCreationalContext<?> dc = it.next();
+                    if(dc.getDependentType().equals(DependentType.INTERCEPTOR) &&
+                       dc.getContextual().equals(interceptor))
+                    {
+                        return dc.getInstance();
+                    }
 
+                }
             }
         }
-
         return null;
     }
 
@@ -270,7 +274,7 @@ public class CreationalContextImpl<T> im
         
         destroying = true;
 
-        //X synchronized(this)
+        synchronized(this)
         {
             Collection<List<DependentCreationalContext<?>>> values = this.dependentObjects.values();
             if(values != null)



Mime
View raw message