summaryrefslogtreecommitdiff
path: root/java/lang/InheritableThreadLocal.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/lang/InheritableThreadLocal.java')
-rw-r--r--java/lang/InheritableThreadLocal.java24
1 files changed, 1 insertions, 23 deletions
diff --git a/java/lang/InheritableThreadLocal.java b/java/lang/InheritableThreadLocal.java
index 2079a4c20..07d52b5d0 100644
--- a/java/lang/InheritableThreadLocal.java
+++ b/java/lang/InheritableThreadLocal.java
@@ -37,10 +37,6 @@ exception statement from your version. */
package java.lang;
-import gnu.java.util.WeakIdentityHashMap;
-
-import java.util.Iterator;
-
/**
* A ThreadLocal whose value is inherited by child Threads. The value of the
* InheritableThreadLocal associated with the (parent) Thread is copied to
@@ -97,24 +93,6 @@ public class InheritableThreadLocal<T> extends ThreadLocal<T>
{
// The currentThread is the parent of the new thread.
Thread parentThread = Thread.currentThread();
- if (parentThread.locals != null)
- {
- Iterator keys = parentThread.locals.keySet().iterator();
- while (keys.hasNext())
- {
- Object key = keys.next();
- if (key instanceof InheritableThreadLocal)
- {
- InheritableThreadLocal local = (InheritableThreadLocal)key;
- Object parentValue = parentThread.locals.get(key);
- Object childValue = local.childValue(parentValue == sentinel
- ? null : parentValue);
- if (childThread.locals == null)
- childThread.locals = new WeakIdentityHashMap();
- childThread.locals.put(key, (childValue == null
- ? sentinel : childValue));
- }
- }
- }
+ childThread.locals.inherit(parentThread.locals);
}
}