The JDWP ThreadReference/Stop command includes the following in its specification:
"The target VM may not support, or may only provide limited support, for stopping a virtual thread with an asynchronous exception. It may, for example, only support this operation when the virtual thread is suspended at a breakpoint or singlestep event."
but the command does not specify the JDWP error that is returned when the target VM does support the command but a virtual thread cannot be stopped for some reason (state, not suspended, ...).
The com.sun.jdi.ThreadReference.stop API is similar:
"The target VM may not support, or may only provide limited support, for stopping a virtual thread with an asynchronous exception. It may, for example, only support this operation when the virtual thread is suspended at a breakpoint or singlestep event."
but the method doesn't specify the exception thrown when the target VM supports "stop" but the virtual thread is not in the right "state". It may be that IllegalThreadStateException is the appropriate exception to throw.
The spec of this command and method needs to be re-examined to avoid incompatible changes in the future when support for stopping a virtual thread with an asynchronous exception is added.
"The target VM may not support, or may only provide limited support, for stopping a virtual thread with an asynchronous exception. It may, for example, only support this operation when the virtual thread is suspended at a breakpoint or singlestep event."
but the command does not specify the JDWP error that is returned when the target VM does support the command but a virtual thread cannot be stopped for some reason (state, not suspended, ...).
The com.sun.jdi.ThreadReference.stop API is similar:
"The target VM may not support, or may only provide limited support, for stopping a virtual thread with an asynchronous exception. It may, for example, only support this operation when the virtual thread is suspended at a breakpoint or singlestep event."
but the method doesn't specify the exception thrown when the target VM supports "stop" but the virtual thread is not in the right "state". It may be that IllegalThreadStateException is the appropriate exception to throw.
The spec of this command and method needs to be re-examined to avoid incompatible changes in the future when support for stopping a virtual thread with an asynchronous exception is added.
- duplicates
-
JDK-8306471 Add virtual threads support to JDWP ThreadReference.Stop and JDI ThreadReference.stop()
-
- Resolved
-