Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4375402

Add ability to obtain full thread dump programmatically

XMLWordPrintable

    • generic, x86, sparc
    • generic, solaris_8, windows_nt, windows_2000



      Name: krC82822 Date: 10/01/2000


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      It would be extremely useful to be able to obtain a full thread dump
      programmatically, e.g. by adding a method to java.lang.Runtime to return what
      otherwise can only be obtained by a Ctrl-C (SIGINT) in the console window.
      If the production version of our application hangs, we have no way of sending
      it an interrupt to obtain the thread dump. But we can add code to the
      application to get the dump on demand (say from a troubleshooting menu).

      For ease of parsing, it would be most convenient if:
      (a) each thread's stack backtrace was returned separately, either as a String
      or a custom class object;
      (b) each monitor in the monitor cache dump was returned separately, either as a
      String or custom class object.

      Looking at the JVM code, I can see that the String return values would be
      easier. Returning an array of Strings would be sufficient.

      Alternatively, perhaps an OutputStream could be supplied to the method and the
      thread dump written to the stream.
      (Review ID: 109991)
      ======================================================================

            mchung Mandy Chung (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: