Summary
Remove java.lang.Thread.suspend
, java.lang.Thread.resume
, java.lang.ThreadGroup.suspend
, and java.lang.ThreadGroup.resume
.
Problem
The deadlock prone suspend/resume methods date from JDK 1.0. These methods were deprecated in JDK 1.2 (1998), and deprecated for removal in Java 14. The ThreadGroup.suspend/resume
method were re-specified/degraded to throw UnsupportedOperationException
(UOE) in Java 19. The Thread.suspend/resume
method were re-specified/degraded to throw UOE in Java 20.
It is time to finally remove these method from the API.
Solution
Remove the 4 methods.
Adjust
java.lang.management.ThreadInfo::isSuspended
so that it doesn't link toThread.suspend
.Update the "Java Thread Primitive Deprecation" docs page, linked from the
Thread.stop
deprecation text, to remove the two questions/answers related to thread suspension.
Specification
Remove java.lang.Thread.suspend
, java.lang.Thread.resume
, java.lang.ThreadGroup.suspend
, and java.lang.ThreadGroup.resume
.
Adjust the specification of java.lang.management.ThreadInfo::isSuspended
to link to the JVM TI SuspendThread function instead of Thread.suspend
.
/**
- * Tests if the thread associated with this {@code ThreadInfo}
- * is suspended. This method returns {@code true} if
- * {@link Thread#suspend} has been called.
+ * Tests if the thread associated with this {@code ThreadInfo} is
+ * <a href="{@docRoot}/../specs/jvmti.html#SuspendThread">suspended</a>.
*
* @return {@code true} if the thread is suspended;
* {@code false} otherwise.
+ *
+ * @spec jvmti.html JVM Tool Interface
*/
- csr of
-
JDK-8320532 Remove Thread/ThreadGroup suspend/resume
- Resolved