Summary
Deprecate, for removal, the methods in java.lang.Thread
and java.lang.ThreadGroup
that relate to thread suspension, specifically:
Thread.suspend()
Thread.resume()
ThreadGroup.suspend()
ThreadGroup.resume()
ThreadGroup.allowThreadSuspension(boolean)
These methods have been deprecated since Java SE 1.2 (1998).
Problem
Suspension is inherently deadlock-prone, these APIs have linked to the "Java Thread Primitive Deprecation" page since they were deprecated.
A second issue is that Project Loom is exploring adding support for "lightweight threads" where the notion of suspension will be very different to that defined by the legacy thread suspension mechanism.
Solution
Add "forRemoval=true" to the Deprecated
annotation on these methods.
No deprecation or changes are proposed to the equivalent APIs in JVM TI or JDI as these are important for debugger operations.
Specification
The addition of "forRemoval=true" will result in the API docs including a removal warning in the "Deprecated" message.
- csr of
-
JDK-8231602 Deprecate Thread.suspend/resume for removal
-
- Resolved
-