Class Threads

java.lang.Object
com.sun.management.Threads

public final class Threads extends Object
Threads is a preview API of the Java platform.
Programs can only use Threads when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
This class consists exclusively of static methods that operate on threads for the purposes of monitoring and management.
Since:
21
  • Method Details

    • currentThreadEnclosingScopes

      public static String currentThreadEnclosingScopes()
      Returns a string that describes the current thread's enclosing scopes or an empty string if there no enclosing scopes.

      If there is a security manager set, and describing an enclosing scope requires getting the stack trace of its owner thread, then the security manager's checkPermission method is called to check the permission RuntimePermission("getStackTrace").

      API Note:
      There is no equivalent at this time to describe the enclosing scopes of other threads.
      Implementation Requirements:
      The default implementation includes the name, owner, and owner stack trace of each enclosing scope.
      Throws:
      SecurityException - if denied by the security manager
      See Also: