RFR [9] 8148861: Remove sun.misc.ManagedLocalsThread from jaxws

Chris Hegarty chris.hegarty at oracle.com
Mon Feb 8 10:52:39 UTC 2016


Miran,

JDK-8056152 added a new constructor to java.lang.Thread for constructing
Threads that do not inherit inheritable thread-local initial values. All usages
of sun.misc.ManagedLocalsThread in the base module were also replaced
with this new constructor. Given there is now a supported API for creating such
threads, other areas of the JDK should be updated to use it, where applicable.
If all usages are replaced, then sun.misc.ManagedLocalsThread can be removed.


The following patch, along with 'hg rm ThreadHelper.java', should be sufficient.
It will remove the dependency on an internal JDK API, but adds a new dependency
on Java SE 9. Is this OK, or does this code need to access the new Java SE 9
constructor using refection? 

diff --git a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/Engine.java b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/Engine.java 
--- a/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/Engine.java 
+++ b/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/pipe/Engine.java 
@@ -108,7 +108,8 @@ 
         } 
  
         public Thread newThread(Runnable r) { 
-            Thread t = ThreadHelper.createNewThread(r); 
-            t.setName(namePrefix + threadNumber.getAndIncrement()); 
+           Thread t = new Thread(null, r, namePrefix + threadNumber.getAndIncrement(), 0, false);  
             t.setName(namePrefix + threadNumber.getAndIncrement()); 
             if (!t.isDaemon()) { 
                 t.setDaemon(true); 

Complete webrev:
  http://cr.openjdk.java.net/~chegar/8148861/

Is is possible, when agreed, to get this small change pushed upstream ?

-Chris.


More information about the core-libs-dev mailing list