[concurrency-interest]thread-local variables

Alexander Terekhov TEREKHOV@de.ibm.com
Wed, 14 Aug 2002 14:50:42 +0200


David Holmes wrote:
[...]
> >     each thread-local, the first time each thread accesses the variable
> >     with the get() or set(Object) method.
> >                       ^^^^^^^^^^^^^^^^^^
> >
> >  ...."
>
> This looks like a documentation bug. If you look at the implementation of
> ThreadLocal.set in the JDK there is no call to initialValue. I can't see
> what you could possibly do with initialValue in a call to set.

DISPOSE it immediately! (close file(s)/shutdown something, etc. ;-) )

Seriously, I also think that it's a docu-bug and that it needs to be
fixed ASAP.

[...]
> > That's OK. (apart from rather unfortunate [IMO] LACK of some *optional*
> > interface/DisposableThreadLocal-"hook" for timely "dispose" action(s)
> > for each non-null thread-local invoked in the context of the
terminating
> > thread... and on brand new clearThreadLocals(), of course. ;-) ;-) )
>
> Sounds like a form of finalization to me. ;-)
                        ^^^^^^^^^^^^

Please, please, don't get me started on this... ;-) ;-)

regards,
alexander.