JDK-6534574 : (ref) I offer a tool for finalization via PhantomReference
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2007-03-14
  • Updated: 2015-12-04
  • Resolved: 2015-12-04
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
There is well-known technique allowing to schedule some operations at the moment, when some given object becomes a "garbage", without using "finalize()" method. This technique is the queue of phantom references. The benefits of such method are described in many paper, for example: http://www.devx.com/Java/Article/30192/0/page/3

Unfortunately, it is not too simple task to correctly use phantom references for this goal. In particular, one of the most difficult issues is synchronization (that is not discussed at all in the paper referred above).

I think the standard Java libraries should contain a convenient tool, as simple as "finalize()" method, allowing to schedule some finalization actions at the moment when the object becomes unreachable. It could be the standard alternative to overriding "finalize()".

Comments
The topic of this issue is covered by the java.lang.ref.Cleaner and can be closed as a duplicate.
04-12-2015

EVALUATION Contribution forum : https://jdk-collaboration.dev.java.net/servlets/ProjectForumMessageView?forumID=1463&messageID=19396
06-04-2007