RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit
David Lloyd
david.lloyd at redhat.com
Mon Jun 18 20:45:01 UTC 2018
On Mon, Jun 18, 2018 at 12:53 PM, Martin Buchholz <martinrb at google.com> wrote:
> On Mon, Jun 18, 2018 at 10:21 AM, Tony Printezis <tprintezis at twitter.com>
> wrote:
>
>> Martin,
>>
>> You are forgiven. :-)
>>
>> So, the (valid, I think) issue with getIfPresent(), as originally proposed
>> by Peter, was that if get() was overridden in the subclass to somehow
>> transform the returned value, getIfPresent() wouldn’t apply the same
>> transformation.
>>
>> Doesn’t your compute() method have essentially the same issue? Apart from
>> that, I personally like this proposal as I agree: one look-up is always
>> better than two.
>>
>>
> A non-prototype implementation would delegate compute into ThreadLocalMap
> itself, where there is no risk of overriding.
I don't think overriding is the risk; the risk would be compute*
behaving inconsistently with regards to an overridden get*.
--
- DML
More information about the core-libs-dev
mailing list