RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit
Alan Bateman
Alan.Bateman at oracle.com
Fri May 11 14:13:25 UTC 2018
On 08/05/2018 16:07, Tony Printezis wrote:
> Hi all,
>
> Following the discussion on this a few weeks ago, here’s the first version
> of the change:
>
> http://cr.openjdk.java.net/~tonyp/8202788/webrev.0/
>
> I think the consensus was that it’d be easier if the exit hooks were only
> available within java.base. Is it enough that I added the functionality to
> the jdk.internal.misc package? (And is jdk.internal.misc the best place for
> this?)
>
> I’ll also add a test for the new functionality. But let’s first come up
> with an approach that everyone is happy with. :-)
>
Peter's approach in early April was clean (and we should come to the
getIfPresent discussion) but it adds a field to Thread for the callback
list. If I read your approach correctly, you are avoiding that by
maintaining an array of hooks in ThreadLocalExitHooks.
Another approach to try is a java.base-internal ThreadLocal that defines
a method to be invoked when a thread terminates. Something like the
following:
http://cr.openjdk.java.net/~alanb/8202788/webrev/index.html
-Alan
More information about the core-libs-dev
mailing list