RFR [9] 8148861: Remove sun.misc.ManagedLocalsThread from jaxws
Mandy Chung
mandy.chung at oracle.com
Mon Feb 8 17:10:54 UTC 2016
> On Feb 8, 2016, at 8:20 AM, Chris Hegarty <chris.hegarty at oracle.com> wrote:
>
> Receiving some feedback off list, this code needs to be able to run on
> older releases, so the new Thread constructor, added in JDK 9, should
> be accessed reflectively. Webrev updated in-place:
>
> http://cr.openjdk.java.net/~chegar/8148861/
>
The original version only uses sun.misc.ManagedLocalsThread when running the JDK’s JAXWS version; but for standalone, it will create a new Thread. This difference is only significant when this change is port to upstream that standalone JAXWS is running on JDK 8 and older release.
Mandy
> -Chris.
>
> On 8 Feb 2016, at 10:52, Chris Hegarty <chris.hegarty at oracle.com> wrote:
>
>> 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