RFR(s): 8204243: remove Thread.destroy() and Thread.stop(Throwable)

Stuart Marks stuart.marks at oracle.com
Sat Jun 2 00:43:33 UTC 2018


On 6/1/18 4:40 PM, David Holmes wrote:
> Hi Stuart!
> 
> Nooooooo!
> 
> Just kidding!
> 
> Yaaaaaay!!!!

:-)

> Actual removal looks fine but what about the corresponding JDI code:
> 
> ./jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java
> 
> it still has a stop(Throwable) function (it doesn't have the no-arg one!). What 
> happens to it? The JDI functions were never deprecated in line with the Thread 
> functions (suspend/resume/stop).
> 
> The ThreadReference javadoc has:
> 
>     * @see java.lang.Thread#stop(Throwable)
> 
> so will need fixing.

Good catch! I had grepped around the source tree for stuff like this but I had 
missed this one.

It looks to me like this interface resides on the debugger side of JDWP. I don't 
know exactly where it's implemented in the target VM, but I imagine it goes 
through some VM-internal or JDWP implementation interface, not through the 
target VM's public java.lang.Thread.stop(thr) interface. Is that right? (I'm not 
that familiar with this area of the system.)

I'm presuming that it doesn't go through j.l.Thread.stop(Throwable) since that 
method has essentially been non-functional since JDK 8.

I see a couple tests for this in

     test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop

and I can see some evidence in our internal build/test systems that they're 
still being run, so it looks like these interfaces are still active. As you 
observe, they haven't been deprecated. There might even be valid uses cases for 
stopping a thread this way in a debugging situation that aren't valid for 
applications.

I guess that means the thing to do is to update the documentation to remove the 
reference to the soon-to-be-deleted Thread.stop(Throwable) but otherwise leave 
this stuff unchanged.

s'marks


More information about the core-libs-dev mailing list