From ed8a8c28baae05a7fbdcb31f31011cdf4ea16986 Mon Sep 17 00:00:00 2001 From: LongyuZhang Date: Mon, 15 Jul 2024 15:17:41 -0400 Subject: [PATCH] Revert "Temporarily restore Thread/ThreadGroup suspend/resume/stop" This reverts commit d987abcc506196944c49f1293ba4cd9eb0d3ee81. Signed-off-by: LongyuZhang --- .../share/classes/java/lang/Thread.java | 38 ------------------- .../share/classes/java/lang/ThreadGroup.java | 33 ---------------- 2 files changed, 71 deletions(-) diff --git a/src/java.base/share/classes/java/lang/Thread.java b/src/java.base/share/classes/java/lang/Thread.java index d77a8cc9758..0a211a694ed 100644 --- a/src/java.base/share/classes/java/lang/Thread.java +++ b/src/java.base/share/classes/java/lang/Thread.java @@ -1831,44 +1831,6 @@ boolean alive() { return eetop != NO_REF; } - /** - * Throws {@code UnsupportedOperationException}. - * - * @throws UnsupportedOperationException always - * - * @deprecated This method was originally specified to suspend a thread. - * It was inherently deadlock-prone. If the target thread held a lock on - * a monitor protecting a critical system resource when it was suspended, - * no thread could access the resource until the target thread was resumed. - * If the thread intending to resume the target thread attempted to lock - * the monitor prior to calling {@code resume}, deadlock would result. - * Such deadlocks typically manifested themselves as "frozen" processes. - * For more information, see - * Why - * are Thread.stop, Thread.suspend and Thread.resume Deprecated?. - */ - @Deprecated(since="1.2", forRemoval=true) - public final void suspend() { - throw new UnsupportedOperationException(); - } - - /** - * Throws {@code UnsupportedOperationException}. - * - * @throws UnsupportedOperationException always - * - * @deprecated This method was originally specified to resume a thread - * suspended with {@link #suspend()}. Suspending a thread was - * inherently deadlock-prone. - * For more information, see - * Why - * are Thread.stop, Thread.suspend and Thread.resume Deprecated?. - */ - @Deprecated(since="1.2", forRemoval=true) - public final void resume() { - throw new UnsupportedOperationException(); - } - /** * Changes the priority of this thread. * diff --git a/src/java.base/share/classes/java/lang/ThreadGroup.java b/src/java.base/share/classes/java/lang/ThreadGroup.java index 94a067a5094..45bd3497f50 100644 --- a/src/java.base/share/classes/java/lang/ThreadGroup.java +++ b/src/java.base/share/classes/java/lang/ThreadGroup.java @@ -555,17 +555,6 @@ private int enumerate(ThreadGroup[] list, int i, boolean recurse) { return i; } - /** - * Throws {@code UnsupportedOperationException}. - * - * @deprecated This method was originally specified to stop all threads in - * the thread group. It was inherently unsafe. - */ - @Deprecated(since="1.2", forRemoval=true) - public final void stop() { - throw new UnsupportedOperationException(); - } - /** * Interrupts all {@linkplain Thread#isAlive() live} platform threads in * this thread group and its subgroups. @@ -588,28 +577,6 @@ public final void interrupt() { } } - /** - * Throws {@code UnsupportedOperationException}. - * - * @deprecated This method was originally specified to suspend all threads - * in the thread group. - */ - @Deprecated(since="1.2", forRemoval=true) - public final void suspend() { - throw new UnsupportedOperationException(); - } - - /** - * Throws {@code UnsupportedOperationException}. - * - * @deprecated This method was originally specified to resume all threads - * in the thread group. - */ - @Deprecated(since="1.2", forRemoval=true) - public final void resume() { - throw new UnsupportedOperationException(); - } - /** * Does nothing. *