unused imports + uh, why would you synchronize access to a ThreadLocal? :P

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@906682 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Matthew Jason Benson 2010-02-04 22:10:24 +00:00
parent a2bb711aee
commit 0d828cd075
1 changed files with 9 additions and 17 deletions

View File

@ -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 boolean isRegistered(Object value) {
*/
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 register(Object value) {
*/
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();
}
}
}