Context:
static ThreadLocal threadLocalMyType = ...
What i\'d like is to say something like:
for (ThreadLoc
One way would be to handle this manually:
ThreadLocal
(extend it)static
) Map
of Threads and valuesAlternatively, with some reflection (getDeclaredMethod()
and setAccessible(true)
), you can:
Thread.getThreads()
yourThreadLocal.getMap(thread)
(for each of the above threads)map.getEntry(yourThreadLocal)
The 1st is more preferable.