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;
* {@code false} otherwise.
* @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() {
return daemon;
}
@ -195,7 +201,12 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
*
* @return true if this object is destroyed
* @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() {
return destroyed;
}
@ -217,7 +228,13 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
* @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) {
checkAccess();
this.daemon = daemon;
@ -602,7 +619,7 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* @deprecated This method is inherently unsafe. See
* {@link Thread#stop} for details.
*/
@Deprecated(since="1.2")
@Deprecated(since="1.2", forRemoval=true)
public final void stop() {
if (stopOrSuspend(false))
Thread.currentThread().stop();
@ -763,7 +780,12 @@ public class ThreadGroup implements Thread.UncaughtExceptionHandler {
* thread group.
* @see java.lang.ThreadGroup#checkAccess()
* @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() {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;

View file

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

View file

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

View file

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