ThreadPoolExecutor and finalization

David Holmes david.holmes at oracle.com
Mon Oct 30 00:40:00 UTC 2017


Hi Roger,

On 30/10/2017 10:24 AM, Roger Riggs wrote:
> Hi,
> 
> With the deprecation of Object.finalize its time to look at its uses too 
> see if they can be removed or mitigated.

So the nice thing about finalize was that it followed a 
nice/clean/simple OO model where a subclass could override, add their 
own cleanup and then call super.finalize(). With finalize() deprecated, 
and the new mechanism being Cleaners, how do Cleaners support such usages?

Thanks,
David

> 
> The ThreadPoolExecutor overrides finalize to shutdown the pool.
> A simple but incomplete step is to retain the shutdown on finalize but 
> remove it from
> the specification of ThreadPoolExecutor.finalize (and remove the 
> override).  [1]
> 
> For those familiar with Executors please take as look at the situation and
> make a recommendation or suggestion.
> 
> Thanks, Roger
> 
> [1]  https://bugs.openjdk.java.net/browse/JDK-8190324
> 
> 
> 
> 


More information about the core-libs-dev mailing list