RFR: 8320532: Remove Thread/ThreadGroup suspend/resume [v2]
Alan Bateman
alanb at openjdk.org
Fri Dec 8 06:39:59 UTC 2023
> The deadlock prone Thread/ThreadGroup suspend/resume were deprecated since JDK 1.2, deprecated for removal in Java 14, and re-specified/degraded to throw UnsupportedOperationException unconditionally in Java 19/20. Early in Java 23 seems a fine time to finally remove these methods.
>
> Corpus analysis of 176 million classes in 485k artifacts found no remaining usages of ThreadGroup.suspend/resume beyond the artifacts that include a copy of java.lang.ThreadGroup (!). It found 87 remaining uses of Thread.suspend and 86 remaining usages of Thread.resume, some of these are tests.
>
> Thread.suspend/resume have always linked to the "Java Thread Primitive Deprecation" page. This originally explained the reasons why suspend/resume were deprecated. When these methods were degraded to throw UOE we changed the text to explain why the ability to suspend or resume a thread was removed. Now we must change it again. One choice is to re-word to explain why the Java APIs were removed or why the Java APIs don't define a way to suspend/resume threads, the other choice (which I prefer) is to remove the text.
>
> The method description of java.lang.management.ThreadInfo.isSuspended is tweaked to link to JVMTI SuspendThread instead of Thread.suspend
Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
- Update copyright year
- Merge
- Clarify ThreadInfo.isSuspended
- Initial commit
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/16789/files
- new: https://git.openjdk.org/jdk/pull/16789/files/cc17ea42..517de309
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=16789&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=16789&range=00-01
Stats: 106040 lines in 2348 files changed: 55620 ins; 41750 del; 8670 mod
Patch: https://git.openjdk.org/jdk/pull/16789.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/16789/head:pull/16789
PR: https://git.openjdk.org/jdk/pull/16789
More information about the serviceability-dev
mailing list