In the course of JEP 188/193 related efforts, it has been pointed out a few times that, as part of these efforts, finally adding method reachabilityFence(ref) with tentative spec pasted below should be the first of two steps in helping developers avoid premature finalization and reclamation. The second part seems to escape scope of these JEPs: Supporting an annotation (most likely named @Finalized) that would enable tools and/or compilers to convert methods of classes in danger of premature finalization from { body } to try { body } finally { Reference.reachabilityFence(this); } And/or some variants, some of which were explored on the jmm-dev list mainly in August 2014 -- see archives at http://mail.openjdk.java.net/pipermail/jmm-dev/2014-August/thread.html This is an issue of large importance to a small audience, and is at the moment an orphan. To work out, I think it requires at least some involvement from compiler and/or IDE developers. If you are or know of someone who might be interested in pursuing, please encourage them/yourself to consider it. -Doug class java.lang.ref.Reference { // add: /** * Ensures that the object referenced by the given reference * remains <em>strongly reachable</em> (as defined in the {@link * java.lang.ref} package documentation), regardless of any prior * actions of the program that might otherwise cause the object to * become unreachable. A reachabilityFence for a given reference * happens before the referenced object is reclaimed by garbage * collection, finalized, or added to a java.lang.ref queue. * Invocation of this method does not itself initiate garbage * collection or finalization. * * @param ref the reference. If null, this method has no effect. */ public static void reachabilityFence(Object ref) {} }
On 08/26/2015 03:01 PM, Doug Lea wrote:
This is an issue of large importance to a small audience, and is at the moment an orphan. To work out, I think it requires at least some involvement from compiler and/or IDE developers. If you are or know of someone who might be interested in pursuing, please encourage them/yourself to consider it.
At the minimum, all this needs is an empty native method. That's not the most efficient long-term solution but it is enough. Andrew.
On 08/26/2015 10:12 AM, Andrew Haley wrote:
On 08/26/2015 03:01 PM, Doug Lea wrote:
This is an issue of large importance to a small audience, and is at the moment an orphan. To work out, I think it requires at least some involvement from compiler and/or IDE developers. If you are or know of someone who might be interested in pursuing, please encourage them/yourself to consider it.
At the minimum, all this needs is an empty native method. That's not the most efficient long-term solution but it is enough.
Right. The reachabilityFence method itself is already in jdk9/sandbox (thanks to Aleksey). The annotation isn't, and can't be until compiler and IDE folks discuss whether and how to support it. -Doug
On 08/26/2015 06:07 PM, Doug Lea wrote:
On 08/26/2015 10:12 AM, Andrew Haley wrote:
On 08/26/2015 03:01 PM, Doug Lea wrote:
This is an issue of large importance to a small audience, and is at the moment an orphan. To work out, I think it requires at least some involvement from compiler and/or IDE developers. If you are or know of someone who might be interested in pursuing, please encourage them/yourself to consider it.
At the minimum, all this needs is an empty native method. That's not the most efficient long-term solution but it is enough.
Right. The reachabilityFence method itself is already in jdk9/sandbox (thanks to Aleksey).
Well, it's not really pushed anywhere yet: https://bugs.openjdk.java.net/browse/JDK-8133348 -Aleksey
On 26/08/15 20:01, Aleksey Shipilev wrote:
On 08/26/2015 06:07 PM, Doug Lea wrote:
On 08/26/2015 10:12 AM, Andrew Haley wrote:
On 08/26/2015 03:01 PM, Doug Lea wrote:
This is an issue of large importance to a small audience, and is at the moment an orphan. To work out, I think it requires at least some involvement from compiler and/or IDE developers. If you are or know of someone who might be interested in pursuing, please encourage them/yourself to consider it.
At the minimum, all this needs is an empty native method. That's not the most efficient long-term solution but it is enough.
Right. The reachabilityFence method itself is already in jdk9/sandbox (thanks to Aleksey).
Well, it's not really pushed anywhere yet: https://bugs.openjdk.java.net/browse/JDK-8133348
Well, that was easy. What did you do in the afternoon? regards, Andrew Dinn ----------- Senior Principal Software Engineer Red Hat UK Ltd Registered in UK and Wales under Company Registration No. 3798903 Directors: Michael Cunningham (USA), Matt Parson (USA), Charlie Peters (USA), Michael O'Neill (Ireland)
participants (4)
-
Aleksey Shipilev
-
Andrew Dinn
-
Andrew Haley
-
Doug Lea