JDK-8154546 : Retire sun.misc.GThreadHelper
  • Type: Sub-task
  • Component: client-libs
  • Affected Version: 9
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2016-04-19
  • Updated: 2016-05-26
  • Resolved: 2016-05-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b120Fixed
Related Reports
Blocks :  
Description
sun.misc.GThreadHelper was introduced by JDK-7059886, for what looks like a co-ordination mechanism for initializing GTK on the platform. Initialization can be initiated by either one of the desktop module or Java FX.

sun.misc.GThreadHelper is not a critical API as defined by JEP 260, so should be moved out of sun.misc.  It looks like it makes sense to move GThreadHelper to an internal package in the desktop module, where it can be access by both the desktop module and Java FX.
Comments
The FX dependency on sun.misc.GThreadHelper was removed by JDK-8087516.
12-05-2016

This was originally added for co-ordination with FX See https://bugs.openjdk.java.net/browse/JDK-7059886 (there was a CCC for this) and the FX side of it :- https://bugs.openjdk.java.net/browse/JDK-8118695 although on GLIB2.20 and later we can check to see if it was already initialised via calling g_thread_get_initialized And on 2.24 and later we don't need to worry at all. According to http://distrowatch.com/table.php?distribution=redhat RHEL 7.2 has GLIB 2.17, so the same should also apply to OEL7.x yet we actually find that the symbol is there. So I don't think I can believe that. Although JDK needs to run on OEL 6 (unlike FX) there is no benefit to retaining this class which is used only by FX. And even OEL 6 seems like it must define this symbol since FX 8 was built on OEL 6 without problem and the symbol is directly referenced. And https://bugs.openjdk.java.net/browse/JDK-8092519 says OEL 6.4 has glib2.27 Also FX 9 has already deleted reference to the helper class so it is now not useful anyway It still appears that if some other library (not FX, and not JDK) initialises the same on a GLIB earlier than 2.24 then it will likely crash but this is already true, so this is no worse than JDK 8, and in fact better as there should be fewer such platforms supported by 9 than 8 and no such platform appears to be in the supported matrix.
11-05-2016

For now, can this class be moved to the desktop module. Further refactoring, or cleanup, then then be done from there.
09-05-2016

src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c jclass clazz = (*env)->FindClass(env, "sun/misc/GThreadHelper"); This could be renamed and move to java.desktop module first if it has to be retained for whatever reason.
25-04-2016

@azvegint since you worked on JDK-7059886, do you see an issues with moving GThreadHelper?
19-04-2016