Java Cup
Inside Java

News and views from members of the Java team at Oracle

JDK 20: Thread.stop(), Thread.suspend() and Thread.resume() degradation - Quality Outreach Heads-up

The OpenJDK Quality Group promotes the testing of FOSS projects with OpenJDK early-access builds as a way to improve the overall quality of the release. This heads-up is part of a Quality Outreach update sent to the projects involved. To learn more about the program and how to join, please check the Quality Outreach wiki page.

JDK 20 - Thread.stop(), Thread.suspend() and Thread.resume() degradation"

The ability to stop, suspend, or resume a thread with the corresponding Thread.stop(), Thread.suspend() or Thread.resume() methods have been removed in JDK 20. Those methods have been degraded to throw a UOE exception (UnsupportedOperationException).

Using those methods was inherently unsafe. That is also why they were deprecated since JDK 1.2 (1998!) and were flagged 'forRemoval' in previous features release.

We do not expect this behavior change to cause issues on well-maintained codebase.

More information

For more details please check JDK-8289610, JDK-8249627, and the Java Thread Primitive Deprecation FAQ.

~