JDK-8145041 : A common Cleaner for general use may be useful
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2015-12-09
  • Updated: 2024-12-18
  • Resolved: 2024-12-18
Related Reports
Relates :  
Description
java.lang.ref.Cleaner supports lightweight cleanup of object without using finalization.  It is up to each class or library to create or share a Cleaner object.
It may be useful to have a common Cleaner to amortize the cost of the thread needed by the cleaner.
There is a risk to applications sharing a cleaner that a misbehaving cleaning function might delay or disrupt cleaning.
Comments
A shared Cleaner was expected to ammortize the cost of the platform thread across clients. However, there are/risks of interference between cleaning tasks. The introduction of virtual threads makes it reasonable for each cleaner thread to be independent of other cleaners.
18-12-2024