commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r906682 - /commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
Date Thu, 04 Feb 2010 22:10:24 GMT
Author: mbenson
Date: Thu Feb  4 22:10:24 2010
New Revision: 906682

URL: http://svn.apache.org/viewvc?rev=906682&view=rev
Log:
unused imports + uh, why would you synchronize access to a ThreadLocal?  :P

Modified:
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java

Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java?rev=906682&r1=906681&r2=906682&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
(original)
+++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
Thu Feb  4 22:10:24 2010
@@ -19,9 +19,7 @@
 import java.io.Serializable;
 import java.lang.reflect.Array;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Map;
-import java.util.Set;
 import java.util.WeakHashMap;
 
 import org.apache.commons.lang3.ClassUtils;
@@ -175,13 +173,10 @@
      */
     static void register(Object value) {
         if (value != null) {
-            WeakHashMap<Object, Object> m;
-            synchronized (ToStringStyle.class) {
-                m = REGISTRY.get();
-                if (m == null) {
-                    m = new WeakHashMap<Object, Object>();
-                    REGISTRY.set(m);
-                }
+            WeakHashMap<Object, Object> m = REGISTRY.get();
+            if (m == null) {
+                m = new WeakHashMap<Object, Object>();
+                REGISTRY.set(m);
             }
             m.put(value, null);
         }
@@ -201,14 +196,11 @@
      */
     static void unregister(Object value) {
         if (value != null) {
-            WeakHashMap<Object, Object> m;
-            synchronized (ToStringStyle.class) {
-                m = REGISTRY.get();
-                if (m != null) {
-                    m.remove(value);
-                    if (m.isEmpty()) {
-                        REGISTRY.remove();
-                    }
+            WeakHashMap<Object, Object> m = REGISTRY.get();
+            if (m != null) {
+                m.remove(value);
+                if (m.isEmpty()) {
+                    REGISTRY.remove();
                 }
             }
         }



Mime
View raw message