[seam-commits] Seam SVN: r12198 - modules/faces/trunk/src/main/java/org/jboss/seam/faces/context.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Mar 12 17:01:54 EST 2010


Author: lincolnthree
Date: 2010-03-12 17:01:53 -0500 (Fri, 12 Mar 2010)
New Revision: 12198

Modified:
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java
   modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java
Log:
Removed some buggy synch code.

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java	2010-03-12 17:13:21 UTC (rev 12197)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/FlashScopedContext.java	2010-03-12 22:01:53 UTC (rev 12198)
@@ -151,11 +151,13 @@
         Flash flash = getFlash();
         ConcurrentHashMap<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) flash
                 .get(COMPONENT_MAP_NAME);
+
         if (map == null)
         {
             map = new ConcurrentHashMap<Contextual<?>, Object>();
             flash.put(COMPONENT_MAP_NAME, map);
         }
+
         return map;
     }
 
@@ -165,11 +167,13 @@
         Flash flash = getFlash();
         Map<Contextual<?>, CreationalContext<?>> map = (ConcurrentHashMap<Contextual<?>, CreationalContext<?>>) flash
                 .get(CREATIONAL_MAP_NAME);
+
         if (map == null)
         {
             map = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
             flash.put(CREATIONAL_MAP_NAME, map);
         }
+
         return map;
     }
 

Modified: modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java
===================================================================
--- modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java	2010-03-12 17:13:21 UTC (rev 12197)
+++ modules/faces/trunk/src/main/java/org/jboss/seam/faces/context/ViewScopedContext.java	2010-03-12 22:01:53 UTC (rev 12198)
@@ -73,6 +73,7 @@
             {
                 Map<Contextual<?>, Object> componentInstanceMap = getComponentInstanceMap();
                 Map<Contextual<?>, CreationalContext<?>> creationalContextMap = getCreationalInstanceMap();
+
                 synchronized (componentInstanceMap)
                 {
                     instance = (T) componentInstanceMap.get(component);
@@ -183,45 +184,30 @@
     private Map<Contextual<?>, Object> getComponentInstanceMap()
     {
         Map<String, Object> viewMap = getViewMap();
-        Map<Contextual<?>, Object> componentInstanceMap = (ConcurrentHashMap<Contextual<?>, Object>) viewMap
-                .get(COMPONENT_MAP_NAME);
+        Map<Contextual<?>, Object> map = (ConcurrentHashMap<Contextual<?>, Object>) viewMap.get(COMPONENT_MAP_NAME);
 
-        if (componentInstanceMap == null)
+        if (map == null)
         {
-            synchronized (componentInstanceMap)
-            {
-                componentInstanceMap = (ConcurrentHashMap<Contextual<?>, Object>) viewMap.get(COMPONENT_MAP_NAME);
-                if (componentInstanceMap == null)
-                {
-                    componentInstanceMap = new ConcurrentHashMap<Contextual<?>, Object>();
-                    viewMap.put(COMPONENT_MAP_NAME, componentInstanceMap);
-                }
-            }
+            map = new ConcurrentHashMap<Contextual<?>, Object>();
+            viewMap.put(COMPONENT_MAP_NAME, map);
         }
 
-        return componentInstanceMap;
+        return map;
     }
 
     @SuppressWarnings("unchecked")
     private Map<Contextual<?>, CreationalContext<?>> getCreationalInstanceMap()
     {
         Map<String, Object> viewMap = getViewMap();
-        Map<Contextual<?>, CreationalContext<?>> creationalContextMap = (Map<Contextual<?>, CreationalContext<?>>) viewMap
+        Map<Contextual<?>, CreationalContext<?>> map = (Map<Contextual<?>, CreationalContext<?>>) viewMap
                 .get(CREATIONAL_MAP_NAME);
 
-        if (creationalContextMap == null)
+        if (map == null)
         {
-            synchronized (creationalContextMap)
-            {
-                creationalContextMap = (Map<Contextual<?>, CreationalContext<?>>) viewMap.get(CREATIONAL_MAP_NAME);
-                if (creationalContextMap == null)
-                {
-                    creationalContextMap = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
-                    viewMap.put(CREATIONAL_MAP_NAME, creationalContextMap);
-                }
-            }
+            map = new ConcurrentHashMap<Contextual<?>, CreationalContext<?>>();
+            viewMap.put(CREATIONAL_MAP_NAME, map);
         }
 
-        return creationalContextMap;
+        return map;
     }
 }
\ No newline at end of file



More information about the seam-commits mailing list