ThreadPoolExecutor and finalization
Roger Riggs
Roger.Riggs at Oracle.com
Mon Oct 30 15:27:36 UTC 2017
Hi,
There is a test
<repo>/test/jdk/java/util/concurrent/Executors/AutoShutdown.java
It only tests it for Executors of newSingleThreadExecutor, not for the
others
so I wondered if there was some open issue.
Roger
On 10/30/2017 11:02 AM, David Lloyd wrote:
> On Mon, Oct 30, 2017 at 9:43 AM, Roger Riggs <Roger.Riggs at oracle.com> wrote:
>> ThreadPoolExecutor has a responsibility to cleanup any native resources it
>> has allocated (threads) and it should be free to use whatever mechanism is appropriate.
> I wonder though whether TPE.finalize() is ever actually hit in
> practice: TPE is (by definition) a thread pool, and every live thread
> in that pool has (by way of TPE.Worker) a strong reference to the TPE
> itself via an outer class reference which is passed around in enough
> places to make me think that it would never actually be collectable in
> a real-world situation, unless all core threads were allowed to time
> out.
>
More information about the core-libs-dev
mailing list