8256643: Terminally deprecate ThreadGroup stop, destroy, isDestroyed, setDaemon and isDaemon

Reviewed-by: serb, rriggs, iris, mchung, smarks
This commit is contained in:
Alan Bateman 2020-11-25 08:26:00 +00:00
parent 0d91f0a1df
commit 79e57ace65
4 changed files with 26 additions and 3 deletions

View file

@ -185,7 +185,13 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @return {@code true} if this thread group is a daemon thread group; * @return {@code true} if this thread group is a daemon thread group;
* {@code false} otherwise. * {@code false} otherwise.
* @since 1.0 * @since 1.0
*
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
* flawed. The ability to explicitly or automatically destroy a
* thread group, and the concept of daemon thread group, will be
* removed in a future release.
*/ */
@Deprecated(since="16", forRemoval=true)
public final boolean isDaemon() { public final boolean isDaemon() {
return daemon; return daemon;
} }
@ -195,7 +201,12 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* *
* @return true if this object is destroyed * @return true if this object is destroyed
* @since 1.1 * @since 1.1
*
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
* flawed. The ability to explicitly or automatically destroy a
* thread group will be removed in a future release.
*/ */
@Deprecated(since="16", forRemoval=true)
public synchronized boolean isDestroyed() { public synchronized boolean isDestroyed() {
return destroyed; return destroyed;
} }
@ -217,7 +228,13 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @see java.lang.SecurityException * @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess() * @see java.lang.ThreadGroup#checkAccess()
* @since 1.0 * @since 1.0
*
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
* flawed. The ability to explicitly or automatically destroy a
* thread group, and the concept of daemon thread group, will be
* removed in a future release.
*/ */
@Deprecated(since="16", forRemoval=true)
public final void setDaemon(boolean daemon) { public final void setDaemon(boolean daemon) {
checkAccess(); checkAccess();
this.daemon = daemon; this.daemon = daemon;
@ -602,7 +619,7 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @deprecated This method is inherently unsafe. See * @deprecated This method is inherently unsafe. See
* {@link Thread#stop} for details. * {@link Thread#stop} for details.
*/ */
@Deprecated(since="1.2") @Deprecated(since="1.2", forRemoval=true)
public final void stop() { public final void stop() {
if (stopOrSuspend(false)) if (stopOrSuspend(false))
Thread.currentThread().stop(); Thread.currentThread().stop();
@ -763,7 +780,12 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* thread group. * thread group.
* @see java.lang.ThreadGroup#checkAccess() * @see java.lang.ThreadGroup#checkAccess()
* @since 1.0 * @since 1.0
*
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
* flawed. The ability to explicitly or automatically destroy a
* thread group will be removed in a future release.
*/ */
@Deprecated(since="16", forRemoval=true)
public final void destroy() { public final void destroy() {
int ngroupsSnapshot; int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot; ThreadGroup[] groupsSnapshot;

View file

@ -1105,6 +1105,7 @@ public class EventQueue {
} }
} }
@SuppressWarnings({"deprecation", "removal"})
final void initDispatchThread() { final void initDispatchThread() {
pushPopLock.lock(); pushPopLock.lock();
try { try {

View file

@ -392,7 +392,7 @@ public final class AppContext {
* contained within this AppContext * contained within this AppContext
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "removal"})
public void dispose() throws IllegalThreadStateException { public void dispose() throws IllegalThreadStateException {
// Check to be sure that the current Thread isn't in this AppContext // Check to be sure that the current Thread isn't in this AppContext
if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) { if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) {

View file

@ -124,7 +124,7 @@ public class LocalExecutionControl extends DirectExecutionControl {
} }
@Override @Override
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "removal"})
public void stop() throws EngineTerminationException, InternalException { public void stop() throws EngineTerminationException, InternalException {
synchronized (STOP_LOCK) { synchronized (STOP_LOCK) {
if (!userCodeRunning) { if (!userCodeRunning) {