net.groboclown.util.jpda.v1
Class JpdaConnector

java.lang.Object
  |
  +--net.groboclown.util.jpda.v1.JpdaConnector

public class JpdaConnector
extends Object

Connects to a remote VM via JPDA. For ease-of-use, the EventQueue methods have been pulled up to this class's public methods in #removeEvent() and #removeEvent( long ). Since this class has special handling of some of the events returned, it is advised that all event removal be done through this class.

To simplify and conserve memory, the boolean values for true and false on the remote VM are mirrored in TRUE and FALSE.

Since:
v0.9.1c
Version:
v0.9.1d
Author:
Matt Albrecht

Inner Class Summary
private  class JpdaConnector.VMDeathEventListener
           
private  class JpdaConnector.VMDisconnectEventListener
           
private  class JpdaConnector.VMStartEventListener
           
 
Field Summary
private  BackgroundProcess bp
           
 BooleanValue FALSE
           
private  boolean isVMstarted
           
private  JpdaEventRegistry registry
           
 BooleanValue TRUE
           
private  VirtualMachine vm
           
 
Constructor Summary
JpdaConnector(VirtualMachine vm)
          Create the Connector based on the given VM.
 
Method Summary
 void close()
          Close the connection, and terminate the remote VM.
protected  void createRegistry(VirtualMachine vm)
          Generate the EventRegistry, and register the default event handlers.
 JpdaEventRegistry getEventRegistry()
          Retrieve the singleton EventRegistry for this connection.
 BackgroundProcess getProcess()
          Gets the Process object of the debugged VM as a BackgroundProcess, if the VM was started via a launchVM call on net.groboclown.util.jdpa.v1.JdpaConnectorFactory.
 Iterator getThreads()
          Retrieves an Iterator which contains ThreadReference objects for each existing Thread object on the remote VM.
 VirtualMachine getVM()
          Retrieve the VM instance associated with this connection.
 boolean isVMDead()
           
 boolean isVMStarted()
           
protected  void verifyVM(VirtualMachine vm)
          Assert the the VM is initialized correctly, and supports the necessary operations.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

vm

private VirtualMachine vm

bp

private BackgroundProcess bp

registry

private JpdaEventRegistry registry

TRUE

public BooleanValue TRUE

FALSE

public BooleanValue FALSE

isVMstarted

private boolean isVMstarted
Constructor Detail

JpdaConnector

public JpdaConnector(VirtualMachine vm)
              throws IOException
Create the Connector based on the given VM.
Method Detail

getVM

public VirtualMachine getVM()
Retrieve the VM instance associated with this connection.

getEventRegistry

public JpdaEventRegistry getEventRegistry()
Retrieve the singleton EventRegistry for this connection.

getProcess

public BackgroundProcess getProcess()
Gets the Process object of the debugged VM as a BackgroundProcess, if the VM was started via a launchVM call on net.groboclown.util.jdpa.v1.JdpaConnectorFactory.

isVMStarted

public boolean isVMStarted()
Returns:
true if a VMStartEvent has been encountered.

isVMDead

public boolean isVMDead()
Returns:
true if the VM has sent either a VMDeathEvent or a VMDisconnectEvent.

close

public void close()
Close the connection, and terminate the remote VM.

getThreads

public Iterator getThreads()
Retrieves an Iterator which contains ThreadReference objects for each existing Thread object on the remote VM.

verifyVM

protected void verifyVM(VirtualMachine vm)
Assert the the VM is initialized correctly, and supports the necessary operations.

createRegistry

protected void createRegistry(VirtualMachine vm)
Generate the EventRegistry, and register the default event handlers.


Written under the LGPL