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

Thread dumps should show actual class locks

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • hotspot
    • b54
    • generic
    • generic

      >>The new thread dump output looks great but I wonder if one little
      >>improvement is possible. When it puts out something like this:
      >>
      >> - locked <0xf495fbb8> (a java.lang.Class)
      >>
      >>is there no way to list the actual class?(e.g. in my case today it is
      >>mostly java.util.logging.Logger) If the program is doing a lot of static
      >>synchronization I'm left staring at and matching up hex numbers, a more
      >>tiresome exercise.
      >>
      public class Foo extends Thread {
        static Object o = new Foo();
        public static void main(String[] args) {
      try {
      synchronized(Foo.class) {
      Foo.class.wait();
      }
      } catch (InterruptedException e){
      System.exit(0);
      }
        }
      }

      Just run this, then kill -3 (On Solaris it's control-\) and you'll see
      something like:

      - waiting on <0xd0c042f8> (a java.lang.Class)

      And the RFE is asking to see "a Foo" instead of "a java.lang.Class".

            ksrini Kumar Srinivasan
            psoper Pete Soper (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: