From 3e2c3a6cf9e3123f8e56634433724408f77f7a30 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 13 Oct 2006 12:42:22 +0000 Subject: 2006-10-12 Andrew Haley * java/lang/InheritableThreadLocal.java: Rename NULL to sentinel. * java/lang/ThreadLocal.java: Likewise. --- ChangeLog | 5 +++++ java/lang/InheritableThreadLocal.java | 4 ++-- java/lang/ThreadLocal.java | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b60f4bc55..fc3686e81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-10-12 Andrew Haley + + * java/lang/InheritableThreadLocal.java: Rename NULL to sentinel. + * java/lang/ThreadLocal.java: Likewise. + 2006-10-04 Roman Kennke * javax/swing/tree/VariableHeightLayoutCache.java diff --git a/java/lang/InheritableThreadLocal.java b/java/lang/InheritableThreadLocal.java index bbcbc0c2f..2079a4c20 100644 --- a/java/lang/InheritableThreadLocal.java +++ b/java/lang/InheritableThreadLocal.java @@ -107,12 +107,12 @@ public class InheritableThreadLocal extends ThreadLocal { InheritableThreadLocal local = (InheritableThreadLocal)key; Object parentValue = parentThread.locals.get(key); - Object childValue = local.childValue(parentValue == NULL + Object childValue = local.childValue(parentValue == sentinel ? null : parentValue); if (childThread.locals == null) childThread.locals = new WeakIdentityHashMap(); childThread.locals.put(key, (childValue == null - ? NULL : childValue)); + ? sentinel : childValue)); } } } diff --git a/java/lang/ThreadLocal.java b/java/lang/ThreadLocal.java index f599cfb44..6c4ba176a 100644 --- a/java/lang/ThreadLocal.java +++ b/java/lang/ThreadLocal.java @@ -93,7 +93,7 @@ public class ThreadLocal * user. Do not expose this to the public. Package visible for use by * InheritableThreadLocal */ - static final Object NULL = new Object(); + static final Object sentinel = new Object(); /** * Creates a ThreadLocal object without associating any value to it yet. @@ -132,9 +132,9 @@ public class ThreadLocal if (value == null) { value = initialValue(); - map.put(this, (T) (value == null ? NULL : value)); + map.put(this, (T) (value == null ? sentinel : value)); } - return value == (T) NULL ? null : value; + return value == (T) sentinel ? null : value; } /** @@ -150,7 +150,7 @@ public class ThreadLocal Map map = Thread.getThreadLocals(); // Note that we don't have to synchronize, as only this thread will // ever modify the map. - map.put(this, value == null ? NULL : value); + map.put(this, value == null ? sentinel : value); } /** -- cgit v1.2.1