[concurrency-interest] DirectByteBuffers and reachabilityFence

Martin Buchholz martinrb at google.com
Tue Dec 15 12:43:48 EST 2015


On Tue, Dec 15, 2015 at 6:50 AM, Vitaly Davidovich <vitalyd at gmail.com> wrote:
> I wonder if this example is hiding some optimization problem.  Although it's
> clear that the TPE does not escape, I'm having a hard time seeing how the
> JIT was able to prove that it could shorten the lifetime of the TPE through
> the swath of code in TPE::execute with all of its atomic ops to boot.

I just added this comment to
https://bugs.openjdk.java.net/browse/JDK-8145304

Part of the problem is that there are two finalize methods in play here.
The implementation does

    public static ExecutorService newSingleThreadExecutor() {
        return new FinalizableDelegatedExecutorService
            (new ThreadPoolExecutor(1, 1,

so the outer executor may get finalized while methods on the inner are
still executing.

Not sure of the motivation for the finalization strategy here.


More information about the Concurrency-interest mailing list