Package javax.tools.diagnostics.runtime.java

Examples of javax.tools.diagnostics.runtime.java.JavaClass


      }
    }
    else
   
     
      JavaClass initialJC = jc;
      List classList = new ArrayList();
      while (jc != null){
       
        classList.add(jc);
        try {
View Full Code Here


                + Long.toHexString(thisClassLoader.getObject().getID().getAddress())
                + " at address: " + ((CorruptData)potential).getAddress(), null);
            continue ITERATING_CLASSES;
          }

          JavaClass thisJavaClass = (JavaClass)potential;
         
          JavaClass superClass = thisJavaClass.getSuperclass();
         
          JavaObject classObject = thisJavaClass.getObject();
         
          int instanceSize = 0;

          if(thisJavaClass.isArray()) {
            instanceSize = 0;
          } else {
            // we need to figure out a way of determining the instance size for a class
          }
         
          formatter.addClass(thisJavaClass.getID().getAddress(),
                thisJavaClass.getName(),
                superClass != null ? superClass.getID().getAddress() : 0,
                classObject != null ? (int)classObject.getSize() : 0,
                instanceSize,
                classObject != null ? (int)classObject.getPersistentHashcode() : 0,
                getClassReferences(thisJavaClass) );
        } catch(DiagnosticException ex) {
View Full Code Here

        continue;
      }

      try {
        JavaObject thisObject = (JavaObject) next;
        JavaClass thisClass = thisObject.getJavaClass();

        int hashcode = 0;

        try {
          hashcode = (int) thisObject.getHashcode();
        }
        catch (DataUnavailable ex) {
          _numberOfErrors++;
          reportError("Failed to get hashcode for object: " + thisObject.getID(),ex);
        }

        if (thisObject.isArray()) {
          if (isPrimitive(thisClass.getComponentType())) {
            formatter.addPrimitiveArray(thisObject.getID().getAddress(),
                          thisClass.getID().getAddress(),
                          getPrimitiveTypeCode(thisClass.getComponentType()),
                          (int) thisObject.getSize(),
                          hashcode,
                          thisObject.getArraySize());
          }
          else {
           
            formatter.addObjectArray(thisObject.getID().getAddress(),
                thisClass.getID().getAddress(),
                thisClass.getName(),
                thisClass.getComponentType().getID().getAddress(),
                thisClass.getComponentType().getName(),
                (int) thisObject.getSize(),
                thisObject.getArraySize(),
                hashcode,
                getObjectReferences(thisObject));
          }
        }
        else {
          formatter.addObject(thisObject.getID().getAddress(),
                    thisClass.getID().getAddress(),
                    thisClass.getName(),
                    (int)thisObject.getSize(),
                    hashcode,
                    getObjectReferences(thisObject));
        }
      }
View Full Code Here

    }
  }
 
  private void printRuntimeClass(JavaRuntime jr, String className)
  {
    JavaClass jc = Utils.getClassGivenName(className, jr, out);
   
    // if we couldn't find a class of that name, return; the passed in class name could
    //  still be an array type or it might not exist
    if (null == jc)
    {
      out.print("\t  could not find class with name \"" + className + "\"\n\n");
      return;
    }

    String spaces = "    ";
    String cdeInfo = "N/A (CorruptDataException occurred)";
    out.print("name = " + className);
    out.print(spaces);
    out.print("\n\n\t");
    out.print("ID = 0x" + Long.toHexString(jc.getID().getAddress()));
   
    String superClassInfo;
    try{
      JavaClass superClass = jc.getSuperclass();
      if (null == superClass) {
        superClassInfo = "<no superclass>";
      } else {
        superClassInfo = "0x" + Long.toHexString(superClass.getID().getAddress());
      }
    }catch (CorruptDataException dce){
      superClassInfo = cdeInfo;
    }
    out.print(spaces);
View Full Code Here

      printClassListHeader();
    } else {
      out.print("\n\t No information found for loaded classes\n");
    }
    while (itClass.hasNext()) {
      JavaClass jc = (JavaClass)itClass.next();
      String className;
     
      try {
        className = jc.getName();
      } catch (CorruptDataException cde) {
        className = Exceptions.getCorruptDataExceptionString();
      }
      Datum d = (Datum)javaClasses.get(jc);
      totalSize += d.getSize();
View Full Code Here

        // Check that this is a JavaObject (there may be CorruptData objects in the
        // JavaHeap, we don't attempt to count these as instances of known classes).
        if (next instanceof JavaObject) {
          JavaObject jo = (JavaObject)next;
          Datum d = null;
          JavaClass jc;
       
          try {
            jc = jo.getJavaClass();
          } catch (CorruptDataException cde) {
            jc = null;
View Full Code Here

      JavaMonitor jMonitor = (JavaMonitor)lockedObjects.next();
      JavaObject jObject = jMonitor.getObject();
      try{
        JavaThread owner = jMonitor.getOwner();
        String className = "<unknown class>";
        JavaClass jClass = jObject.getJavaClass()
        if (null != jClass) {
            className = jClass.getName();
        }
        String jObjectID = Long.toHexString(jObject.getID().getAddress());
        if (null == owner) {
          out.println(className + "@0x" + jObjectID + " locked by an unknown thread");
        } else {
View Full Code Here

TOP

Related Classes of javax.tools.diagnostics.runtime.java.JavaClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.