< prev index next >

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

Print this page

    1407      *
    1408      * @return  {@code true} if this thread is a daemon thread;
    1409      *          {@code false} otherwise.
    1410      * @see     #setDaemon(boolean)
    1411      */
    1412     public final boolean isDaemon() {
    1413         return daemon;
    1414     }
    1415
    1416     /**
    1417      * Determines if the currently running thread has permission to
    1418      * modify this thread.
    1419      * <p>
    1420      * If there is a security manager, its {@code checkAccess} method
    1421      * is called with this thread as its argument. This may result in
    1422      * throwing a {@code SecurityException}.
    1423      *
    1424      * @throws  SecurityException  if the current thread is not allowed to
    1425      *          access this thread.
    1426      * @see        SecurityManager#checkAccess(Thread)

    1427      */

    1428     public final void checkAccess() {
    1429         SecurityManager security = System.getSecurityManager();
    1430         if (security != null) {
    1431             security.checkAccess(this);
    1432         }
    1433     }
    1434
    1435     /**
    1436      * Returns a string representation of this thread, including the
    1437      * thread's name, priority, and thread group.
    1438      *
    1439      * @return  a string representation of this thread.
    1440      */
    1441     public String toString() {
    1442         ThreadGroup group = getThreadGroup();
    1443         if (group != null) {
    1444             return "Thread[" + getName() + "," + getPriority() + "," +
    1445                            group.getName() + "]";
    1446         } else {
    1447             return "Thread[" + getName() + "," + getPriority() + "," +
    1407      *
    1408      * @return  {@code true} if this thread is a daemon thread;
    1409      *          {@code false} otherwise.
    1410      * @see     #setDaemon(boolean)
    1411      */
    1412     public final boolean isDaemon() {
    1413         return daemon;
    1414     }
    1415
    1416     /**
    1417      * Determines if the currently running thread has permission to
    1418      * modify this thread.
    1419      * <p>
    1420      * If there is a security manager, its {@code checkAccess} method
    1421      * is called with this thread as its argument. This may result in
    1422      * throwing a {@code SecurityException}.
    1423      *
    1424      * @throws  SecurityException  if the current thread is not allowed to
    1425      *          access this thread.
    1426      * @see        SecurityManager#checkAccess(Thread)
    1427      * @deprecated This method is only useful in conjunction with
    1428      *       {@linkplain SecurityManager the Security Manager}, which is
    1429      *       deprecated and subject to removal in a future release.
    1430      *       Consequently, this method is also deprecated and subject to
    1431      *       removal. There is no replacement for the Security Manager or this
    1432      *       method.
    1433      */
    1434     @Deprecated(since="17", forRemoval=true)
    1435     public final void checkAccess() {
    1436         SecurityManager security = System.getSecurityManager();
    1437         if (security != null) {
    1438             security.checkAccess(this);
    1439         }
    1440     }
    1441
    1442     /**
    1443      * Returns a string representation of this thread, including the
    1444      * thread's name, priority, and thread group.
    1445      *
    1446      * @return  a string representation of this thread.
    1447      */
    1448     public String toString() {
    1449         ThreadGroup group = getThreadGroup();
    1450         if (group != null) {
    1451             return "Thread[" + getName() + "," + getPriority() + "," +
    1452                            group.getName() + "]";
    1453         } else {
    1454             return "Thread[" + getName() + "," + getPriority() + "," +

< prev index next >