[concurrency-interest] Soliciting input about removeAllThreadLocals

Eric D Crahen crahen@cse.Buffalo.EDU
Fri, 6 Dec 2002 08:46:27 -0500 (EST)

On Fri, 6 Dec 2002, Eric D Crahen wrote:

> Perhaps, there is a better way to structure a task, which does have access
> to this knowledge, so that these problems can be avoided. That seems like
> a place for a solution to me. But I haven't got any suggestions right now

I just thought of one, but I'm late for something so it'll be quick ;)

What if a flag were just added to the constructor of a ThreadLocal so that
it could be marked when its created as a ThreadLocal that should be reset
before Executors run the task. This way trying to guess which ThreadLocals
actually are safe to be reset or not could be avoided, and the user would
have control over when this happens & when it doesn't. Then maybe
something like, resetTaggedThreadLocals() or something with a prettier
name could be added instead?

- Eric