src/share/classes/java/lang/ThreadGroup.java
Print this page
rev 10048 : 8044740: Convert all JDK versions used in @since tag to 1.n[.n] in jdk repo
Reviewed-by:
*** 38,48 ****
* A thread is allowed to access information about its own thread
* group, but not to access information about its thread group's
* parent thread group or any other thread groups.
*
* @author unascribed
! * @since JDK1.0
*/
/* The locking strategy for this code is to try to lock only one level of the
* tree wherever possible, but otherwise to lock from the bottom up.
* That is, from child thread groups to parents.
* This has the advantage of limiting the number of locks that need to be held
--- 38,48 ----
* A thread is allowed to access information about its own thread
* group, but not to access information about its thread group's
* parent thread group or any other thread groups.
*
* @author unascribed
! * @since 1.0
*/
/* The locking strategy for this code is to try to lock only one level of the
* tree wherever possible, but otherwise to lock from the bottom up.
* That is, from child thread groups to parents.
* This has the advantage of limiting the number of locks that need to be held
*** 88,98 ****
*
* @param name the name of the new thread group.
* @exception SecurityException if the current thread cannot create a
* thread in the specified thread group.
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
*/
public ThreadGroup(String name) {
this(Thread.currentThread().getThreadGroup(), name);
}
--- 88,98 ----
*
* @param name the name of the new thread group.
* @exception SecurityException if the current thread cannot create a
* thread in the specified thread group.
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
*/
public ThreadGroup(String name) {
this(Thread.currentThread().getThreadGroup(), name);
}
*** 109,119 ****
* <code>null</code>.
* @exception SecurityException if the current thread cannot create a
* thread in the specified thread group.
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
*/
public ThreadGroup(ThreadGroup parent, String name) {
this(checkParentAccess(parent), parent, name);
}
--- 109,119 ----
* <code>null</code>.
* @exception SecurityException if the current thread cannot create a
* thread in the specified thread group.
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
*/
public ThreadGroup(ThreadGroup parent, String name) {
this(checkParentAccess(parent), parent, name);
}
*** 138,148 ****
/**
* Returns the name of this thread group.
*
* @return the name of this thread group.
! * @since JDK1.0
*/
public final String getName() {
return name;
}
--- 138,148 ----
/**
* Returns the name of this thread group.
*
* @return the name of this thread group.
! * @since 1.0
*/
public final String getName() {
return name;
}
*** 158,168 ****
* @exception SecurityException if the current thread cannot modify
* this thread group.
* @see java.lang.ThreadGroup#checkAccess()
* @see java.lang.SecurityException
* @see java.lang.RuntimePermission
! * @since JDK1.0
*/
public final ThreadGroup getParent() {
if (parent != null)
parent.checkAccess();
return parent;
--- 158,168 ----
* @exception SecurityException if the current thread cannot modify
* this thread group.
* @see java.lang.ThreadGroup#checkAccess()
* @see java.lang.SecurityException
* @see java.lang.RuntimePermission
! * @since 1.0
*/
public final ThreadGroup getParent() {
if (parent != null)
parent.checkAccess();
return parent;
*** 174,184 ****
* priority.
*
* @return the maximum priority that a thread in this thread group
* can have.
* @see #setMaxPriority
! * @since JDK1.0
*/
public final int getMaxPriority() {
return maxPriority;
}
--- 174,184 ----
* priority.
*
* @return the maximum priority that a thread in this thread group
* can have.
* @see #setMaxPriority
! * @since 1.0
*/
public final int getMaxPriority() {
return maxPriority;
}
*** 187,207 ****
* daemon thread group is automatically destroyed when its last
* thread is stopped or its last thread group is destroyed.
*
* @return <code>true</code> if this thread group is a daemon thread group;
* <code>false</code> otherwise.
! * @since JDK1.0
*/
public final boolean isDaemon() {
return daemon;
}
/**
* Tests if this thread group has been destroyed.
*
* @return true if this object is destroyed
! * @since JDK1.1
*/
public synchronized boolean isDestroyed() {
return destroyed;
}
--- 187,207 ----
* daemon thread group is automatically destroyed when its last
* thread is stopped or its last thread group is destroyed.
*
* @return <code>true</code> if this thread group is a daemon thread group;
* <code>false</code> otherwise.
! * @since 1.0
*/
public final boolean isDaemon() {
return daemon;
}
/**
* Tests if this thread group has been destroyed.
*
* @return true if this object is destroyed
! * @since 1.1
*/
public synchronized boolean isDestroyed() {
return destroyed;
}
*** 219,229 ****
* thread group as normal.
* @exception SecurityException if the current thread cannot modify
* this thread group.
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
*/
public final void setDaemon(boolean daemon) {
checkAccess();
this.daemon = daemon;
}
--- 219,229 ----
* thread group as normal.
* @exception SecurityException if the current thread cannot modify
* this thread group.
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
*/
public final void setDaemon(boolean daemon) {
checkAccess();
this.daemon = daemon;
}
*** 252,262 ****
* @exception SecurityException if the current thread cannot modify
* this thread group.
* @see #getMaxPriority
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
*/
public final void setMaxPriority(int pri) {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
--- 252,262 ----
* @exception SecurityException if the current thread cannot modify
* this thread group.
* @see #getMaxPriority
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
*/
public final void setMaxPriority(int pri) {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
*** 283,293 ****
*
* @param g a thread group.
* @return <code>true</code> if this thread group is the thread group
* argument or one of its ancestor thread groups;
* <code>false</code> otherwise.
! * @since JDK1.0
*/
public final boolean parentOf(ThreadGroup g) {
for (; g != null ; g = g.parent) {
if (g == this) {
return true;
--- 283,293 ----
*
* @param g a thread group.
* @return <code>true</code> if this thread group is the thread group
* argument or one of its ancestor thread groups;
* <code>false</code> otherwise.
! * @since 1.0
*/
public final boolean parentOf(ThreadGroup g) {
for (; g != null ; g = g.parent) {
if (g == this) {
return true;
*** 305,315 ****
* in throwing a <code>SecurityException</code>.
*
* @exception SecurityException if the current thread is not allowed to
* access this thread group.
* @see java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup)
! * @since JDK1.0
*/
public final void checkAccess() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkAccess(this);
--- 305,315 ----
* in throwing a <code>SecurityException</code>.
*
* @exception SecurityException if the current thread is not allowed to
* access this thread group.
* @see java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup)
! * @since 1.0
*/
public final void checkAccess() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkAccess(this);
*** 329,339 ****
*
* @return an estimate of the number of active threads in this thread
* group and in any other thread group that has this thread
* group as an ancestor
*
! * @since JDK1.0
*/
public int activeCount() {
int result;
// Snapshot sub-group data so we don't hold this lock
// while our children are computing.
--- 329,339 ----
*
* @return an estimate of the number of active threads in this thread
* group and in any other thread group that has this thread
* group as an ancestor
*
! * @since 1.0
*/
public int activeCount() {
int result;
// Snapshot sub-group data so we don't hold this lock
// while our children are computing.
*** 375,385 ****
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since JDK1.0
*/
public int enumerate(Thread list[]) {
checkAccess();
return enumerate(list, 0, true);
}
--- 375,385 ----
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since 1.0
*/
public int enumerate(Thread list[]) {
checkAccess();
return enumerate(list, 0, true);
}
*** 413,423 ****
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since JDK1.0
*/
public int enumerate(Thread list[], boolean recurse) {
checkAccess();
return enumerate(list, 0, recurse);
}
--- 413,423 ----
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since 1.0
*/
public int enumerate(Thread list[], boolean recurse) {
checkAccess();
return enumerate(list, 0, recurse);
}
*** 466,476 ****
* debugging and monitoring purposes.
*
* @return the number of active thread groups with this thread group as
* an ancestor
*
! * @since JDK1.0
*/
public int activeGroupCount() {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
--- 466,476 ----
* debugging and monitoring purposes.
*
* @return the number of active thread groups with this thread group as
* an ancestor
*
! * @since 1.0
*/
public int activeGroupCount() {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
*** 509,519 ****
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since JDK1.0
*/
public int enumerate(ThreadGroup list[]) {
checkAccess();
return enumerate(list, 0, true);
}
--- 509,519 ----
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since 1.0
*/
public int enumerate(ThreadGroup list[]) {
checkAccess();
return enumerate(list, 0, true);
}
*** 547,557 ****
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since JDK1.0
*/
public int enumerate(ThreadGroup list[], boolean recurse) {
checkAccess();
return enumerate(list, 0, recurse);
}
--- 547,557 ----
*
* @throws SecurityException
* if {@linkplain #checkAccess checkAccess} determines that
* the current thread cannot access this thread group
*
! * @since 1.0
*/
public int enumerate(ThreadGroup list[], boolean recurse) {
checkAccess();
return enumerate(list, 0, recurse);
}
*** 601,611 ****
* to access this thread group or any of the threads in
* the thread group.
* @see java.lang.SecurityException
* @see java.lang.Thread#stop()
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
* @deprecated This method is inherently unsafe. See
* {@link Thread#stop} for details.
*/
@Deprecated
public final void stop() {
--- 601,611 ----
* to access this thread group or any of the threads in
* the thread group.
* @see java.lang.SecurityException
* @see java.lang.Thread#stop()
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
* @deprecated This method is inherently unsafe. See
* {@link Thread#stop} for details.
*/
@Deprecated
public final void stop() {
*** 663,673 ****
* to access this thread group or any of the threads in
* the thread group.
* @see java.lang.Thread#suspend()
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
* @deprecated This method is inherently deadlock-prone. See
* {@link Thread#suspend} for details.
*/
@Deprecated
@SuppressWarnings("deprecation")
--- 663,673 ----
* to access this thread group or any of the threads in
* the thread group.
* @see java.lang.Thread#suspend()
* @see java.lang.SecurityException
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
* @deprecated This method is inherently deadlock-prone. See
* {@link Thread#suspend} for details.
*/
@Deprecated
@SuppressWarnings("deprecation")
*** 724,734 ****
* access this thread group or any of the threads in the
* thread group.
* @see java.lang.SecurityException
* @see java.lang.Thread#resume()
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
* @deprecated This method is used solely in conjunction with
* <tt>Thread.suspend</tt> and <tt>ThreadGroup.suspend</tt>,
* both of which have been deprecated, as they are inherently
* deadlock-prone. See {@link Thread#suspend} for details.
*/
--- 724,734 ----
* access this thread group or any of the threads in the
* thread group.
* @see java.lang.SecurityException
* @see java.lang.Thread#resume()
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
* @deprecated This method is used solely in conjunction with
* <tt>Thread.suspend</tt> and <tt>ThreadGroup.suspend</tt>,
* both of which have been deprecated, as they are inherently
* deadlock-prone. See {@link Thread#suspend} for details.
*/
*** 765,775 ****
* @exception IllegalThreadStateException if the thread group is not
* empty or if the thread group has already been destroyed.
* @exception SecurityException if the current thread cannot modify this
* thread group.
* @see java.lang.ThreadGroup#checkAccess()
! * @since JDK1.0
*/
public final void destroy() {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
--- 765,775 ----
* @exception IllegalThreadStateException if the thread group is not
* empty or if the thread group has already been destroyed.
* @exception SecurityException if the current thread cannot modify this
* thread group.
* @see java.lang.ThreadGroup#checkAccess()
! * @since 1.0
*/
public final void destroy() {
int ngroupsSnapshot;
ThreadGroup[] groupsSnapshot;
synchronized (this) {
*** 978,988 ****
/**
* Prints information about this thread group to the standard
* output. This method is useful only for debugging.
*
! * @since JDK1.0
*/
public void list() {
list(System.out, 0);
}
void list(PrintStream out, int indent) {
--- 978,988 ----
/**
* Prints information about this thread group to the standard
* output. This method is useful only for debugging.
*
! * @since 1.0
*/
public void list() {
list(System.out, 0);
}
void list(PrintStream out, int indent) {
*** 1043,1053 ****
* <code>ThreadGroup</code> to provide alternative handling of
* uncaught exceptions.
*
* @param t the thread that is about to exit.
* @param e the uncaught exception.
! * @since JDK1.0
*/
public void uncaughtException(Thread t, Throwable e) {
if (parent != null) {
parent.uncaughtException(t, e);
} else {
--- 1043,1053 ----
* <code>ThreadGroup</code> to provide alternative handling of
* uncaught exceptions.
*
* @param t the thread that is about to exit.
* @param e the uncaught exception.
! * @since 1.0
*/
public void uncaughtException(Thread t, Throwable e) {
if (parent != null) {
parent.uncaughtException(t, e);
} else {
*** 1066,1076 ****
/**
* Used by VM to control lowmem implicit suspension.
*
* @param b boolean to allow or disallow suspension
* @return true on success
! * @since JDK1.1
* @deprecated The definition of this call depends on {@link #suspend},
* which is deprecated. Further, the behavior of this call
* was never specified.
*/
@Deprecated
--- 1066,1076 ----
/**
* Used by VM to control lowmem implicit suspension.
*
* @param b boolean to allow or disallow suspension
* @return true on success
! * @since 1.1
* @deprecated The definition of this call depends on {@link #suspend},
* which is deprecated. Further, the behavior of this call
* was never specified.
*/
@Deprecated
*** 1084,1094 ****
/**
* Returns a string representation of this Thread group.
*
* @return a string representation of this thread group.
! * @since JDK1.0
*/
public String toString() {
return getClass().getName() + "[name=" + getName() + ",maxpri=" + maxPriority + "]";
}
}
--- 1084,1094 ----
/**
* Returns a string representation of this Thread group.
*
* @return a string representation of this thread group.
! * @since 1.0
*/
public String toString() {
return getClass().getName() + "[name=" + getName() + ",maxpri=" + maxPriority + "]";
}
}