Package com.sun.jdi

Examples of com.sun.jdi.ThreadReference


         * @param target the target in which the thread started
         * @return <code>true</code> - the thread should be resumed
         */
        public boolean handleEvent(Event event,
                                   JDIDebugTarget target) {
            ThreadReference thread = ((ThreadStartEvent) event).thread();
            try {
                if ( thread.isCollected() ) {
                    return false;
                }
            } catch ( VMDisconnectedException exception ) {
                return false;
            } catch ( ObjectCollectedException e ) {
View Full Code Here


                    //System.out.println( entryEvent + ":" + entryEvent.location() );

                    try {
                        IThread[] tharr = getThreads();
                        ThreadReference t = null;
                        DroolsThread t2 = null;
                        for (int i = 0; i < tharr.length; i++) {
                            DroolsThread th2 = (DroolsThread) tharr[i];
                            ThreadReference th2real = ((DroolsThread) tharr[i]).getUnderlyingThread();
                            if (th2real.suspendCount() == 1    && th2.getName().equals("main")) {
                                t = th2real;
                                t2 = (DroolsThread) th2;
                                th2real.suspend();
                                th2.setRunning(false);
                                th2.fireSuspendEvent(DebugEvent.CLIENT_REQUEST);
                                return true;
                            }
                        }
View Full Code Here

        args.add( lineVal );

        try {
            ClassType tt = (ClassType) debugHandlerClass;
            IThread[] tharr = getThreads();
            ThreadReference t = null;
            DroolsThread t2 = null;

            for ( int i = 0; i < tharr.length; i++ ) {
                IThread th2 = tharr[i];
                ThreadReference th2real = ((DroolsThread) tharr[i]).getUnderlyingThread();

                if ( th2real.suspendCount() == 1 && th2.getName().equals( "main" ) ) {
                    t = th2real;
                    t2 = (DroolsThread) th2;
                }
            }
View Full Code Here

        args.add( lineVal );

        try {
            ClassType tt = (ClassType) debugHandlerClass;
            IThread[] tharr = getThreads();
            ThreadReference t = null;
            DroolsThread t2 = null;

            for ( int i = 0; i < tharr.length; i++ ) {
                IThread th2 = tharr[i];
                ThreadReference th2real = ((DroolsThread) tharr[i]).getUnderlyingThread();

                if ( th2real.suspendCount() == 1 && th2.getName().equals( "main" ) ) {
                    t = th2real;
                    t2 = (DroolsThread) th2;
                }
            }
View Full Code Here

         * @param target the target in which the thread died
         * @return <code>true</code> - the thread should be resumed
         */
        public boolean handleEvent(Event event,
                                   JDIDebugTarget target) {
            ThreadReference ref = ((ThreadDeathEvent) event).thread();
            DroolsThread thread = (DroolsThread) findThread( ref );
            if ( thread != null ) {
                synchronized ( fThreads ) {
                    fThreads.remove( thread );
                }
View Full Code Here

            || event instanceof VMDisconnectEvent) {
          return null;
        }
        if (event instanceof BreakpointEvent) {
          event.request().disable();
          ThreadReference thread = ((BreakpointEvent) event).thread();
          return new VMRemoteTarget(process, vm, thread, debugPort);
        }
      }
      eventSet.resume();
    }
View Full Code Here

  }

  @Test
  public void testEvaluate() throws Throwable {
    ObjectReference promise = remote.evaluateForked("3+4");
    ThreadReference thread = ((ThreadReference) remote.invokeMethod(
        promise, "thread"));
    Value result1 = remote.invokeMethod(promise, "result");
    Value ex = remote.invokeMethod(promise, "throwable");
    printThreadState();
    VMTargetStarter.sleep(100);
View Full Code Here

  }

  @Test
  public void testDNU() throws Throwable {
    ObjectReference promise = remote.evaluateForked("3 fromage");
    ThreadReference thread = ((ThreadReference) remote.invokeMethod(
        promise, "thread"));
    remote.invokeMethod(thread, "start");
    ObjectReference state = (ObjectReference) remote.invokeMethod(thread, "getState");
    StringReference str = (StringReference) remote.invokeMethod(state, "toString");
    System.out.println(str.value());
   
    printStack(thread);
//    assertFalse(thread.isSuspended());
    printThreadState();
    System.out.println("VMTargetStarter.sleep(1000)");
    VMTargetStarter.sleep(1000);
    printStack(thread);
    printThreadState();

    boolean isFinished = ((BooleanValue) remote.invokeMethod(promise,
        "isFinished")).booleanValue();

    assertFalse(isFinished);
    printThreadState();

    printStack(thread);
    assertTrue(thread.isAtBreakpoint());
  }
View Full Code Here

      break;
    case DEBUG_THREAD_CHANGE_REQUESTED:
      setSelectedThread((ThreadReference) event.getThread().getThreadReferenceObject());
      break;
    case DEBUG_THREAD_CHANGED:
      ThreadReference thread = (ThreadReference) event.getThread().getThreadReferenceObject();
      updateStackFrameList(thread);
      break;
    case DEBUG_STACK_FRAME_CHANGE_REQUESTED:
      setSelectedStackFrame((StackFrame) event.getStackFrame().getStackFrameObject());
      break;
View Full Code Here

              }
            } else if (event instanceof VMDeathEvent) {
            } else if (event instanceof VMDisconnectEvent) {
              break eventHandlingLoop;
            } else if (event instanceof BreakpointEvent || event instanceof StepEvent) {
              final ThreadReference thread;
              if (event instanceof BreakpointEvent) {
                BreakpointEvent be = (BreakpointEvent) event;
                thread = be.thread();
              } else {
                StepEvent se = (StepEvent) event;
                thread = se.thread();
                this.vm.eventRequestManager().deleteEventRequest(se.request());
              }
              SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                  net.sf.rej.gui.event.Event event = new net.sf.rej.gui.event.Event(EventType.DEBUG_SUSPENDED);
                  event.setVM(new VirtualMachineWrapper(vm));
                  dispatcher.notifyObservers(event);
                  event = new net.sf.rej.gui.event.Event(EventType.DEBUG_THREAD_CHANGE_REQUESTED);
                  event.setThread(new ThreadReferenceWrapper(thread));
                  dispatcher.notifyObservers(event);
                  event = new net.sf.rej.gui.event.Event(EventType.DEBUG_STACK_FRAME_CHANGE_REQUESTED);
                  try {
                    event.setStackFrame(new StackFrameWrapper(thread.frame(0)));
                  } catch (IncompatibleThreadStateException e) {
                    e.printStackTrace();
                  }
                  dispatcher.notifyObservers(event);
                }
View Full Code Here

TOP

Related Classes of com.sun.jdi.ThreadReference

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.