Title: [1982] trunk: Unnecessary synchronization accessing the field cache decreases performance (XSTR-705).
Revision
1982
Author
joehni
Date
2012-09-13 16:10:55 -0500 (Thu, 13 Sep 2012)

Log Message

Unnecessary synchronization accessing the field cache decreases performance (XSTR-705).

Modified Paths

Diff

Modified: trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java (1981 => 1982)


--- trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java	2012-07-17 21:24:45 UTC (rev 1981)
+++ trunk/xstream/src/java/com/thoughtworks/xstream/converters/reflection/FieldDictionary.java	2012-09-13 21:10:55 UTC (rev 1982)
@@ -118,7 +118,6 @@
     }
 
     private Map buildMap(final Class type, boolean tupleKeyed) {
-        final Map result;
         Class cls = type;
         synchronized (this) {
             if (!keyedByFieldNameCache.containsKey(type)) {
@@ -170,14 +169,12 @@
                         lastKeyedByFieldKey = (Map)keyedByFieldKeyCache.get(cls);
                     }
                 }
-                result = tupleKeyed ? lastKeyedByFieldKey : lastKeyedByFieldName;
-            } else {
-                result = (Map)(tupleKeyed
-                    ? keyedByFieldKeyCache.get(type)
-                    : keyedByFieldNameCache.get(type));
+                return tupleKeyed ? lastKeyedByFieldKey : lastKeyedByFieldName;
             }
         }
-        return result;
+        return (Map)(tupleKeyed
+                ? keyedByFieldKeyCache.get(type)
+                : keyedByFieldNameCache.get(type));
     }
 
     public synchronized void flushCache() {

Modified: trunk/xstream-distribution/src/content/changes.html (1981 => 1982)


--- trunk/xstream-distribution/src/content/changes.html	2012-07-17 21:24:45 UTC (rev 1981)
+++ trunk/xstream-distribution/src/content/changes.html	2012-09-13 21:10:55 UTC (rev 1982)
@@ -27,11 +27,17 @@
 	<a href="" and
 	<a href="" Log</a>.
 	</p>
-<!--  
+  
     <h1 id="upcoming">Upcoming</h1>
 
     <p>Not yet released.</p>
--->
+
+    <h2>Minor changes</h2>
+    
+    <ul>
+    	<li>JIRA:XSTR-705: Unnecessary synchronization accessing the field cache decreases performance.</li>
+    </ul>
+
     <h1 id="1.4.3">1.4.3</h1>
 
     <p>Released 17. July 2012.</p>

To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to