Package javax.tools.diagnostics.runtime.java

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


    assertNotNull("Owner count incorrect", owner);
  }

  public void testNameWaiters_2_2_1() throws Exception {
    JavaMonitor monitor = (JavaMonitor)setup.findMonitorThreadConfig(2, 2, 1).getMonitor();   
    Iterator waiters = monitor.getNotifyWaiters().iterator();

    String error = checkNames(waiters, generatePrefix(2, 2, 1)
        + "-" + SetupJavaMonitor_ObjectMonitors.monitorNotifyThreadName , 2);
    assertNull(error, error);
  }
View Full Code Here


        + "-" + SetupJavaMonitor_ObjectMonitors.monitorNotifyThreadName , 2);
    assertNull(error, error);
  }

  public void testNameEnters_2_2_1() throws Exception {
    JavaMonitor monitor = (JavaMonitor)setup.findMonitorThreadConfig(2, 2, 1).getMonitor();   
    Iterator enters = monitor.getEnterWaiters().iterator();

    String error = checkNames(enters, generatePrefix(2, 2, 1) + "-"
        + SetupJavaMonitor_ObjectMonitors.monitorEnterThreadName, 2);
   
    assertNull(error, error);
View Full Code Here

   
    assertNull(error, error);
  }
 
  public void testNameOwners_2_2_1() throws Exception {
    JavaMonitor monitor = (JavaMonitor)setup.findMonitorThreadConfig(2, 2, 1).getMonitor();
    JavaThread owner = monitor.getOwner();

    assertEquals("Owner name incorrect", generatePrefix(2, 2, 1) + "-"
        + SetupJavaMonitor_ObjectMonitors.monitorOwnerThreadName + "-0", owner.getName());
  }
View Full Code Here

   */
  public void testGetID() throws Exception {
    Set foundSet = new HashSet(SetupJavaMonitor_ObjectMonitors.NUM_MONITORS);
   
    for (int i=0; i < SetupJavaMonitor_ObjectMonitors.NUM_MONITORS; i++){
      JavaMonitor monitor=(JavaMonitor) setup.monitorConfigs[i].monitor;
      ImagePointer id = monitor.getID();
     
      assertNotNull("Found null monitor id for " + setup.monitorConfigs[i].id, id);
     
      assertFalse("Found duplicate monitor id. " + setup.monitorConfigs[i].id, foundSet.contains(id));
     
View Full Code Here

 
  ////////////////////////////////////
 
  public void testGetName() throws Exception {
    for (int i=0; i < SetupJavaMonitor_ObjectMonitors.NUM_MONITORS; i++){
      JavaMonitor monitor=(JavaMonitor) setup.monitorConfigs[i].monitor;
      String name = monitor.getName();
     
      assertNotNull("Found null monitor name for " + setup.monitorConfigs[i].id, name);
    }
  }
View Full Code Here

    }
  }
 
  public void testGetObject() throws Exception {
    for (int i=0; i < SetupJavaMonitor_ObjectMonitors.NUM_MONITORS; i++){
      JavaMonitor monitor=(JavaMonitor) setup.monitorConfigs[i].monitor;
      JavaObject object = monitor.getObject();
     
      assertEquals("Monitor object class unexpected name.",setup.monitorClassName, object.getJavaClass().getName());
     
      JavaField idField = getJavaField(object, "id");
      String idString = idField.getString(object);
View Full Code Here

        System.getProperty("java.vm.version"));
   
    for (int i = 0; i < setup.monitorConfigs.length; i++) {
      System.out.println("Printing out status of "+ setup.monitorConfigs[i].id);
      System.out.println("==================================");
      JavaMonitor monitor = (JavaMonitor) setup.monitorConfigs[i].getMonitor();
     
      if (monitor == null) {
        System.out.println("monitor = null");
        continue;
      }
     
      try {
        System.out.println("monitor.getName()"+ monitor.getName());
      } catch (CorruptDataException e) {
        assertNotNull(e.getCorruptData());
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
     
      System.out.println("\nmonitor.getEntersWaiters():");
     
      Iterator enters = monitor.getEnterWaiters().iterator();
     
      while (enters.hasNext()) {
        Object next = enters.next();
       
        if (next instanceof CorruptData) {
          System.out.println("enter waiter corrupt: "+ next);
          continue;
        }
       
        JavaThread thread = (JavaThread) next;
       
        try {
          System.out.println("EnterWaiter: "+thread.getName());
        } catch (CorruptDataException e) {
          assertNotNull(e.getCorruptData());
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
               
               
      }
     
      System.out.println("\nmonitor.getNotifyWaiters():");
     
      Iterator notifiers = monitor.getNotifyWaiters().iterator();
     
      while (notifiers.hasNext()) {
        Object next = notifiers.next();
       
        if (next instanceof CorruptData) {
          System.out.println("notify waiter corrupt: "+ next);
          continue;
        }
       
        JavaThread thread = (JavaThread) next;
       
        try {
          System.out.println("NotifyWaiter: "+thread.getName());
        } catch (CorruptDataException e) {
          assertNotNull(e.getCorruptData());
          // TODO Auto-generated catch block
          e.printStackTrace();
        }               
      }
     
      JavaThread thread;
      try {
        thread = monitor.getOwner();
        if (thread == null) {
          System.out.println("Owner thread = null");
        } else {
          try {
            System.out.println("Owner thread = "+thread.getName());
View Full Code Here

      // Ignore corrupt data
      if (next instanceof CorruptData) {
        continue;
      }

      JavaMonitor monitorCandidate = (JavaMonitor) next;
     
      //System.out.println("Monitor candidate->"+monitorCandidate.getName());
      JavaObject monitorObjectCandidate = monitorCandidate.getObject();

      if (monitorObjectCandidate != null) {
        JavaClass monitorClass = monitorObjectCandidate.getJavaClass();
        if (!SetupJavaMonitor_ObjectMonitors.monitorClassName.equals(monitorClass.getName())) {
          continue;
View Full Code Here

      }
    }
  }

  public void testFindMonitor_0_1_1() throws Exception {
    JavaMonitor monitor = (JavaMonitor) setup.findMonitorThreadConfig(0, 1, 1).getMonitor();

    assertNotNull("Couldn't find 0-1-1", monitor);
  }
View Full Code Here

    assertNotNull("Couldn't find 0-1-1", monitor);
  }

  public void testGetID_0_1_1() throws Exception {
    JavaMonitor monitor = (JavaMonitor) setup.findMonitorThreadConfig(0, 1, 1).getMonitor();

    assertNotNull("JavaMonitor.getID() for 0-1-1 is null.", monitor.getID());
  }
View Full Code Here

TOP

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

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.