Package javax.tools.diagnostics.runtime.java

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


   * @throws Exception
   */
  public void testGetStackMethods() throws Exception {
    Iterator threads = getJavaRuntime().getThreads().iterator();
   
    JavaThread testThread = null;
    while(threads.hasNext()) {
      Object next = threads.next();
     
      if (next instanceof JavaThread) {
        JavaThread thread = (JavaThread) next;
        if (thread.getName().equals(SetupJavaMethod_getName.threadName)) {
          testThread = thread;
          break;
        }
      } else {
        break;
View Full Code Here


  public void testSimpleThreadCreation() throws Exception {
    assertNotNull(threadDumpInstances);
    JavaObject o1=threadDumpInstances[0];
   
    Thread t=new Thread();
    JavaThread jt;
   
  }
View Full Code Here

 
  public void setUp () {
    JavaRuntime runtime = getJavaRuntime();
    Iterator threads = runtime.getThreads().iterator();
    JavaThread contrivedThread = null;
    while (threads.hasNext()) {
      Object next = threads.next();
     
      if (next instanceof JavaThread) {
        JavaThread thread = (JavaThread) next;
        try {
          //System.out.println("Thread: " + thread.getName());
          if (SetupJavaStackFrame_getHeapRoots.threadName.equals( thread.getName())) {
//            System.out.println("Thread " + thread.getName() + " found!");
            contrivedThread = thread;
            break;
          }
        } catch (CorruptDataException e) {
View Full Code Here

  public void testAllThreadsNamed()
  {
    Iterator threads = defaultJavaRuntime().getThreads().iterator();
   
    while (threads.hasNext()) {
      JavaThread thread = (JavaThread) threads.next();
     
      try {
        assertNotNull(thread.getName());
        thread.getPriority();
      } catch (CorruptDataException e) {
        assertTrue(false);
      }
    }
  }
View Full Code Here

{
  private JavaStackFrame _frame = null;
 
  public  JavaStackFrame defaultJavaStackFrame()
  {
    JavaThread thread = defaultJavaThread();
    Iterator it = thread.getStackFrames().iterator();
    assertNotNull(it);
    assertTrue(it.hasNext());
    return (JavaStackFrame) it.next();
  }
View Full Code Here

  public void testExpectedThreadState() throws CorruptDataException {
   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    int state=t1.getState();
    assertEquals(JavaThread.STATE_ALIVE | JavaThread.STATE_WAITING | JavaThread.STATE_SLEEPING,
        (state & (JavaThread.STATE_ALIVE | JavaThread.STATE_WAITING | JavaThread.STATE_SLEEPING)));
   
  }
View Full Code Here

 
  public void testHasThreadStack() throws CorruptDataException {
   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    Iterator i=t1.getStackFrames().iterator();
    assertTrue(i.hasNext());
   
   
  }
View Full Code Here

  }
  public void testThreadStackFrameLocation() throws CorruptDataException {
   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    Iterator i=t1.getStackFrames().iterator();
    JavaStackFrame frame=(JavaStackFrame) i.next();
    JavaLocation location=frame.getLocation();
    assertNotNull(location);
   
   
View Full Code Here

  }
  public void testThreadStackFrameLocationMethod() throws CorruptDataException {
   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    Iterator i=t1.getStackFrames().iterator();
    JavaStackFrame frame=(JavaStackFrame) i.next();
    JavaLocation location=frame.getLocation();
    JavaMethod  method=location.getMethod();
    assertNotNull(method);
   
View Full Code Here

  }
public void testThreadStackFrameLocationMethodName() throws CorruptDataException {
   
    List allThreads = getJavaRuntime().getThreads();
   
    JavaThread t1=getThread(allThreads,SetupJavaRuntimeThreads.DTFJ_TCK_T1);
    Iterator i=t1.getStackFrames().iterator();
    JavaStackFrame frame=(JavaStackFrame) i.next();
    JavaLocation location=frame.getLocation();
    JavaMethod  method=location.getMethod();
    String name=method.getName();
    assertEquals(name,"sleep");
View Full Code Here

TOP

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

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.