Package javax.tools.diagnostics.runtime.java

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


      if (nextHeap instanceof CorruptData) {
        System.err.println("returned CorruptData `" + nextHeap + "'");
        break;
      }

      JavaHeap aJavaHeap = (JavaHeap) nextHeap;
      Iterator objects = aJavaHeap.getObjects().iterator();

      while (objects.hasNext()) {
        Object nextObject = objects.next();
        if (nextObject instanceof CorruptData) {
          System.err.println("returned CorruptData `" + nextObject + "'");
View Full Code Here


     
      if (nextHeap instanceof CorruptData) {
        continue;
      }
     
      JavaHeap heap = (JavaHeap) nextHeap;
     
      for(Iterator objects = heap.getObjects().iterator(); objects.hasNext();) {
        Object nextObject = objects.next();
       
        if (nextObject instanceof CorruptData) {
          continue;         
        }
View Full Code Here

   
  }
 
  public void testGetSectionsReturns() throws IOException {
   
    JavaHeap heap=getPopulatedJavaHeap();
    List i=heap.getSections();
    assertNotNull(i);
   
  }
View Full Code Here

    assertNotNull(i);
   
  }
  public void testGetSectionsIsEmpty() throws IOException {
   
    JavaHeap heap=getPopulatedJavaHeap();
    Iterator i=heap.getSections().iterator();
    assertFalse("expected empty iterator",i.hasNext());
   
  }
View Full Code Here

   
  }
 
  public void testGetObjectsReturns() throws Exception {
   
    JavaHeap heap=getPopulatedJavaHeap();
    Iterator i=heap.getObjects().iterator();
   
    int count=0;
    while (i.hasNext()) {
      JavaObject obj = (JavaObject)i.next();
      count++;
View Full Code Here

      if (nextHeap instanceof CorruptData) {
        System.err.println("returned CorruptData `" + nextHeap + "'");
        break;
      }

      JavaHeap aJavaHeap = (JavaHeap) nextHeap;
      Iterator objects = aJavaHeap.getObjects().iterator();

      while (objects.hasNext()) {
        Object nextObject = objects.next();
        if (nextObject instanceof CorruptData) {
          System.err.println("returned CorruptData `" + nextObject + "'");
View Full Code Here

  public JavaHeap defaultJavaHeap() {
    JavaRuntime runtime  = defaultJavaRuntime();
    Iterator it = runtime.getHeaps().iterator();
    assertNotNull(it);
    assertTrue(it.hasNext());
    JavaHeap heap = (JavaHeap) it.next();

    // This should use Middleware Heap as default
    // move on to Middleware Heap
    if (heap.getName().equalsIgnoreCase("System Heap")){
      heap = (JavaHeap) it.next();
      if (heap.getName().equalsIgnoreCase("Transient Heap")){
        heap = (JavaHeap) it.next();
      }       
    }

    return (JavaHeap) heap;
View Full Code Here

    return (JavaHeap) heap;
  }

  public JavaObject defaultJavaObject(boolean isArray) {
    JavaObject foundObject = null;
    JavaHeap heap = defaultJavaHeap();
    Iterator objects = heap.getObjects().iterator();
   
    while ((null == foundObject) && (objects.hasNext())) {
      JavaObject oneObject = (JavaObject) objects.next();
     
      try {
View Full Code Here

   * and that addresses outside the heap or not pointing to an object start
   * throw the expected exceptions.
   */
  public void testGetObjectAtAddress()
  {
    JavaHeap heap = defaultJavaHeap();
    JavaRuntime runtime = defaultJavaRuntime();
    ImageAddressSpace addressSpace = defaultAddressSpace();
    ImagePointer address=null;
    ImagePointer unalignedAddress=null;
    Iterator heapSections = heap.getSections().iterator();


    //determine the heap start and end address
    long heapStartAddress = Long.MAX_VALUE;
    long heapEndAddress = 0;

    Object nextElement = null;

    ImageSection currentSection = null;
    long sectionStart = 0;

    while (heapSections.hasNext()) {
      nextElement = heapSections.next();
      if (nextElement instanceof ImageSection) {
        currentSection = (ImageSection) nextElement;
        sectionStart = currentSection.getBaseAddress().getAddress();
        if (sectionStart < heapStartAddress) {
          heapStartAddress = sectionStart;
        }
        if (sectionStart + currentSection.getSize() > heapEndAddress) {
          heapEndAddress = sectionStart + currentSection.getSize();
        }

      }

    }

    //check that every object in the heap can be retrieved by address
    boolean exception=false;
    for (Iterator objects = heap.getObjects().iterator();objects.hasNext();) {
      Object potentialObject = objects.next();
      JavaObject object = null;
      if (potentialObject instanceof JavaObject) {
        object = (JavaObject)potentialObject;
      } else {
View Full Code Here

      assertNotNull(it);
      assertTrue(it.hasNext());
      while (it.hasNext()) {
        Object next = it.next();
        assertTrue(next instanceof JavaHeap);
        JavaHeap heap = (JavaHeap) next;
        Iterator objects = heap.getObjects().iterator();
        assertNotNull(objects);
        while (objects.hasNext()) {
          Object one = objects.next();
          assertTrue(one instanceof JavaObject);
        }
View Full Code Here

TOP

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

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.