@@ -1798,65 +1798,41 @@ boolean alive() {
1798
1798
private native boolean isAlive0 ();
1799
1799
1800
1800
/**
1801
- * Suspends this thread.
1802
- * <p>
1803
- * First, the {@code checkAccess} method of this thread is called
1804
- * with no arguments. This may result in throwing a
1805
- * {@code SecurityException} (in the current thread).
1806
- * <p>
1807
- * If the thread is alive, it is suspended and makes no further
1808
- * progress unless and until it is resumed.
1809
- *
1810
- * @throws SecurityException if the current thread cannot modify
1811
- * this thread.
1812
- * @throws UnsupportedOperationException if invoked on a virtual thread
1813
- * @see #checkAccess
1814
- * @deprecated This method has been deprecated, as it is
1815
- * inherently deadlock-prone. If the target thread holds a lock on the
1816
- * monitor protecting a critical system resource when it is suspended, no
1817
- * thread can access this resource until the target thread is resumed. If
1818
- * the thread that would resume the target thread attempts to lock this
1819
- * monitor prior to calling {@code resume}, deadlock results. Such
1820
- * deadlocks typically manifest themselves as "frozen" processes.
1821
- * For more information, see
1822
- * <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
1823
- * are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
1801
+ * Throws {@code UnsupportedOperationException}.
1802
+ *
1803
+ * @throws UnsupportedOperationException always
1804
+ *
1805
+ * @deprecated This method was originally specified to suspend a thread.
1806
+ * It was inherently deadlock-prone. If the target thread held a lock on
1807
+ * a monitor protecting a critical system resource when it was suspended,
1808
+ * no thread could access the resource until the target thread was resumed.
1809
+ * If the thread intending to resume the target thread attempted to lock
1810
+ * the monitor prior to calling {@code resume}, deadlock would result.
1811
+ * Such deadlocks typically manifested themselves as "frozen" processes.
1812
+ * For more information, see
1813
+ * <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
1814
+ * are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
1824
1815
*/
1825
1816
@ Deprecated (since ="1.2" , forRemoval =true )
1826
1817
public final void suspend () {
1827
- checkAccess ();
1828
- if (isVirtual ())
1829
- throw new UnsupportedOperationException ();
1830
- suspend0 ();
1818
+ throw new UnsupportedOperationException ();
1831
1819
}
1832
1820
1833
1821
/**
1834
- * Resumes a suspended thread.
1835
- * <p>
1836
- * First, the {@code checkAccess} method of this thread is called
1837
- * with no arguments. This may result in throwing a
1838
- * {@code SecurityException} (in the current thread).
1839
- * <p>
1840
- * If the thread is alive but suspended, it is resumed and is
1841
- * permitted to make progress in its execution.
1822
+ * Throws {@code UnsupportedOperationException}.
1842
1823
*
1843
- * @throws SecurityException if the current thread cannot modify this
1844
- * thread.
1845
- * @throws UnsupportedOperationException if invoked on a virtual thread
1846
- * @see #checkAccess
1847
- * @see #suspend()
1848
- * @deprecated This method exists solely for use with {@link #suspend},
1849
- * which has been deprecated because it is deadlock-prone.
1824
+ * @throws UnsupportedOperationException always
1825
+ *
1826
+ * @deprecated This method was originally specified to resume a thread
1827
+ * suspended with {@link #suspend()}. Suspending a thread was
1828
+ * inherently deadlock-prone.
1850
1829
* For more information, see
1851
1830
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
1852
1831
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
1853
1832
*/
1854
1833
@ Deprecated (since ="1.2" , forRemoval =true )
1855
1834
public final void resume () {
1856
- checkAccess ();
1857
- if (isVirtual ())
1858
- throw new UnsupportedOperationException ();
1859
- resume0 ();
1835
+ throw new UnsupportedOperationException ();
1860
1836
}
1861
1837
1862
1838
/**
@@ -3035,8 +3011,6 @@ static void setHeadStackableScope(StackableScope scope) {
3035
3011
3036
3012
/* Some private helper methods */
3037
3013
private native void setPriority0 (int newPriority );
3038
- private native void suspend0 ();
3039
- private native void resume0 ();
3040
3014
private native void interrupt0 ();
3041
3015
private static native void clearInterruptEvent ();
3042
3016
private native void setNativeName (String name );
0 commit comments