/*
  * (non-Javadoc)
  *
  * @see java.lang.Runnable#run()
  */
 public void run() {
   while (!shutdown) {
     try {
       EventPacket event =
           (EventPacket) debugSession.receive(JSONConstants.EVENT, VirtualMachine.DEFAULT_TIMEOUT);
       handleEvent(event);
     } catch (TimeoutException e) {
       // ignore
     } catch (DisconnectedException e) {
       e.printStackTrace();
     }
   }
 }
  /**
   * Continues the handler
   *
   * @param event
   * @param step
   */
  protected void sendContinue(EventPacket event, String step) {
    Number threadId = (Number) event.getBody().get("threadId"); // $NON-NLS-1$

    RhinoRequest request = new RhinoRequest("continue"); // $NON-NLS-1$
    request.getArguments().put("threadId", threadId); // $NON-NLS-1$
    request.getArguments().put("step", step); // $NON-NLS-1$
    try {
      debugSession.send(request);
      debugSession.receiveResponse(request.getSequence(), VirtualMachine.DEFAULT_TIMEOUT);
    } catch (DisconnectedException e) {
      if (!shutdown) {
        e.printStackTrace();
      }
    } catch (TimeoutException e) {
      if (!shutdown) {
        e.printStackTrace();
      }
    }
  }