[concurrency-interest] NullPointerExceptionin ThreadLocal$ThreadLocalMap.replaceStaleEntry

Thomas Hawtin tackline at tackline.plus.com
Fri Jun 30 13:18:42 EDT 2006


Taras Tielkes wrote:
> 
> Now for a bit off-topic...I heard that a new implementation of 
> ThreadLocal will make it into Dolphin, eliminating both the lingering 
> stale entries, and the value->key reference path limitation. Any thuth 
> to this, or better, details?

I believe the current thinking is that an early dolphin build will have 
clearer documentation[1]. A java.lang.ReclaimableThreadLocal[2] (extends 
ThreadLocal) will provide a better behaved implementation (of some 
description). It's difficult to come up with a well behaved 
implementation that performs as well as the current implementation on 
multiprocessor machines (particularly without making changes deep within 
the JVM).

Tom Hawtin

[1] "(spec thread) ThreadLocal.remove documentation needs improvement 
wrt reclaiming objects"
         http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6422556

[2] "(thread) Provide reclaimable thread local values without Thread 
termination"
         http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6254531


More information about the Concurrency-interest mailing list