[concurrency-interest] DirectByteBuffers and reachabilityFence

Doug Lea dl at cs.oswego.edu
Tue Dec 15 16:24:35 EST 2015


On 12/15/2015 12:43 PM, Martin Buchholz wrote:
> 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.

See http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6399443
and concurrency-interest discussion in March 2006 with subject
   Finalization changes to DelegatedExecutorService
http://cs.oswego.edu/pipermail/concurrency-interest/2006-March/thread.html

Without this, some users were leaking Executors/Threads.
This is arguably not our (j.u.c) problem.
But after some resistance, we decided to add the finalizer.
With it, users may encounter surprisingly early shutdown without
reachabilityFence.

-Doug







More information about the Concurrency-interest mailing list