Skip to content

Commit 79e57ac

Browse files
author
Alan Bateman
committed
8256643: Terminally deprecate ThreadGroup stop, destroy, isDestroyed, setDaemon and isDaemon
Reviewed-by: serb, rriggs, iris, mchung, smarks
1 parent 0d91f0a commit 79e57ac

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

src/java.base/share/classes/java/lang/ThreadGroup.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,13 @@ public final int getMaxPriority() {
185185
* @return {@code true} if this thread group is a daemon thread group;
186186
* {@code false} otherwise.
187187
* @since 1.0
188+
*
189+
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
190+
* flawed. The ability to explicitly or automatically destroy a
191+
* thread group, and the concept of daemon thread group, will be
192+
* removed in a future release.
188193
*/
194+
@Deprecated(since="16", forRemoval=true)
189195
public final boolean isDaemon() {
190196
return daemon;
191197
}
@@ -195,7 +201,12 @@ public final boolean isDaemon() {
195201
*
196202
* @return true if this object is destroyed
197203
* @since 1.1
204+
*
205+
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
206+
* flawed. The ability to explicitly or automatically destroy a
207+
* thread group will be removed in a future release.
198208
*/
209+
@Deprecated(since="16", forRemoval=true)
199210
public synchronized boolean isDestroyed() {
200211
return destroyed;
201212
}
@@ -217,7 +228,13 @@ public synchronized boolean isDestroyed() {
217228
* @see java.lang.SecurityException
218229
* @see java.lang.ThreadGroup#checkAccess()
219230
* @since 1.0
231+
*
232+
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
233+
* flawed. The ability to explicitly or automatically destroy a
234+
* thread group, and the concept of daemon thread group, will be
235+
* removed in a future release.
220236
*/
237+
@Deprecated(since="16", forRemoval=true)
221238
public final void setDaemon(boolean daemon) {
222239
checkAccess();
223240
this.daemon = daemon;
@@ -602,7 +619,7 @@ private int enumerate(ThreadGroup list[], int n, boolean recurse) {
602619
* @deprecated This method is inherently unsafe. See
603620
* {@link Thread#stop} for details.
604621
*/
605-
@Deprecated(since="1.2")
622+
@Deprecated(since="1.2", forRemoval=true)
606623
public final void stop() {
607624
if (stopOrSuspend(false))
608625
Thread.currentThread().stop();
@@ -763,7 +780,12 @@ public final void resume() {
763780
* thread group.
764781
* @see java.lang.ThreadGroup#checkAccess()
765782
* @since 1.0
783+
*
784+
* @deprecated The API and mechanism for destroying a ThreadGroup is inherently
785+
* flawed. The ability to explicitly or automatically destroy a
786+
* thread group will be removed in a future release.
766787
*/
788+
@Deprecated(since="16", forRemoval=true)
767789
public final void destroy() {
768790
int ngroupsSnapshot;
769791
ThreadGroup[] groupsSnapshot;

src/java.desktop/share/classes/java/awt/EventQueue.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ final boolean isDispatchThreadImpl() {
11051105
}
11061106
}
11071107

1108+
@SuppressWarnings({"deprecation", "removal"})
11081109
final void initDispatchThread() {
11091110
pushPopLock.lock();
11101111
try {

src/java.desktop/share/classes/sun/awt/AppContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public static boolean isMainContext(AppContext ctx) {
392392
* contained within this AppContext
393393
* @since 1.2
394394
*/
395-
@SuppressWarnings("deprecation")
395+
@SuppressWarnings({"deprecation", "removal"})
396396
public void dispose() throws IllegalThreadStateException {
397397
// Check to be sure that the current Thread isn't in this AppContext
398398
if (this.threadGroup.parentOf(Thread.currentThread().getThreadGroup())) {

src/jdk.jshell/share/classes/jdk/jshell/execution/LocalExecutionControl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ protected String invoke(Method doitMethod) throws Exception {
124124
}
125125

126126
@Override
127-
@SuppressWarnings("deprecation")
127+
@SuppressWarnings({"deprecation", "removal"})
128128
public void stop() throws EngineTerminationException, InternalException {
129129
synchronized (STOP_LOCK) {
130130
if (!userCodeRunning) {

0 commit comments

Comments
 (0)