RFR: 8003246: Add Supplier to ThreadLocal

Doug Lea dl at cs.oswego.edu
Wed Dec 5 19:51:13 UTC 2012


On 12/05/12 14:39, Akhil Arora wrote:
> This patch adds a constructor to ThreadLocal to supply initial values using the
> new Supplier functional interface. Please review. This work was done by Jim Gish.
>
> http://cr.openjdk.java.net/~akhil/8003246.0/webrev/
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8003246
>
> Thanks
>

I see that EVERY ThreadLocal now has an extra field in case it is
used with a Supplier. I expect that those web frameworks that create
thousands of ThreadLocals (not just instances of Threadlocals)
will see a measurable space increase. has anyone measure the impact?

Did anyone consider instead  defining a SuppliedThreadLocal
subclass (or some better name) to isolate the impact?


-Doug




More information about the core-libs-dev mailing list