< prev index next >

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

Print this page

     303         for (; g != null ; g = g.parent) {
     304             if (g == this) {
     305                 return true;
     306             }
     307         }
     308         return false;
     309     }
     310
     311     /**
     312      * Determines if the currently running thread has permission to
     313      * modify this thread group.
     314      * <p>
     315      * If there is a security manager, its {@code checkAccess} method
     316      * is called with this thread group as its argument. This may result
     317      * in throwing a {@code SecurityException}.
     318      *
     319      * @throws     SecurityException  if the current thread is not allowed to
     320      *               access this thread group.
     321      * @see        java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup)
     322      * @since      1.0

     323      */

     324     public final void checkAccess() {
     325         SecurityManager security = System.getSecurityManager();
     326         if (security != null) {
     327             security.checkAccess(this);
     328         }
     329     }
     330
     331     /**
     332      * Returns an estimate of the number of active threads in this thread
     333      * group and its subgroups. Recursively iterates over all subgroups in
     334      * this thread group.
     335      *
     336      * <p> The value returned is only an estimate because the number of
     337      * threads may change dynamically while this method traverses internal
     338      * data structures, and might be affected by the presence of certain
     339      * system threads. This method is intended primarily for debugging
     340      * and monitoring purposes.
     341      *
     342      * @return  an estimate of the number of active threads in this thread
     343      *          group and in any other thread group that has this thread
     303         for (; g != null ; g = g.parent) {
     304             if (g == this) {
     305                 return true;
     306             }
     307         }
     308         return false;
     309     }
     310
     311     /**
     312      * Determines if the currently running thread has permission to
     313      * modify this thread group.
     314      * <p>
     315      * If there is a security manager, its {@code checkAccess} method
     316      * is called with this thread group as its argument. This may result
     317      * in throwing a {@code SecurityException}.
     318      *
     319      * @throws     SecurityException  if the current thread is not allowed to
     320      *               access this thread group.
     321      * @see        java.lang.SecurityManager#checkAccess(java.lang.ThreadGroup)
     322      * @since      1.0
     323      * @deprecated This method is only useful in conjunction with
     324      *       {@linkplain SecurityManager the Security Manager}, which is
     325      *       deprecated and subject to removal in a future release.
     326      *       Consequently, this method is also deprecated and subject to
     327      *       removal. There is no replacement for the Security Manager or this
     328      *       method.
     329      */
     330     @Deprecated(since="17", forRemoval=true)
     331     public final void checkAccess() {
     332         SecurityManager security = System.getSecurityManager();
     333         if (security != null) {
     334             security.checkAccess(this);
     335         }
     336     }
     337
     338     /**
     339      * Returns an estimate of the number of active threads in this thread
     340      * group and its subgroups. Recursively iterates over all subgroups in
     341      * this thread group.
     342      *
     343      * <p> The value returned is only an estimate because the number of
     344      * threads may change dynamically while this method traverses internal
     345      * data structures, and might be affected by the presence of certain
     346      * system threads. This method is intended primarily for debugging
     347      * and monitoring purposes.
     348      *
     349      * @return  an estimate of the number of active threads in this thread
     350      *          group and in any other thread group that has this thread

< prev index next >