[jboss-svn-commits] JBoss Common SVN: r3348 - jboss-logmanager/trunk/src/main/java/org/jboss/logmanager.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Jul 8 22:55:23 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-07-08 22:55:22 -0400 (Wed, 08 Jul 2009)
New Revision: 3348

Modified:
   jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
Log:
Minor fix in attachment creation

Modified: jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java
===================================================================
--- jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-07-09 01:17:33 UTC (rev 3347)
+++ jboss-logmanager/trunk/src/main/java/org/jboss/logmanager/Logger.java	2009-07-09 02:55:22 UTC (rev 3348)
@@ -270,8 +270,8 @@
                     return (V) oldAttachments.get(key);
                 }
                 newAttachments = new HashMap<AttachmentKey, Object>(oldAttachments);
+                newAttachments.put(key, value);
             }
-            newAttachments.put(key, value);
         } while (! attachmentsUpdater.compareAndSet(this, oldAttachments, newAttachments));
         return null;
     }
@@ -299,10 +299,11 @@
             if (result == null) {
                 return null;
             }
-            if (oldAttachments.size() == 1) {
+            final int size = oldAttachments.size();
+            if (size == 1) {
                 // special case - the new map is empty
                 newAttachments = Collections.emptyMap();
-            } else if (oldAttachments.size() == 2) {
+            } else if (size == 2) {
                 // special case - the new map is a singleton
                 final Iterator<Map.Entry<AttachmentKey,Object>> it = oldAttachments.entrySet().iterator();
                 // find the entry that we are not removing




More information about the jboss-svn-commits mailing list