net.groboclown.util.jpda.v1
Class JpdaEventRegistry

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

public class JpdaEventRegistry
extends Object

Handles events


Field Summary
private  EventRequestManager erm
           
private  EventQueue queue
           
private  HashMap registry
           
private  EventSet set
           
private  VirtualMachine vm
           
 
Constructor Summary
JpdaEventRegistry(VirtualMachine vm)
          Create a new registry.
 
Method Summary
 void addEventListener(Class event, JpdaEventListener l)
          Register the given listener to be fired every time an event of the given class is generated.
 void addEventListener(EventRequest request, JpdaEventListener l)
          Register a listener with the given request.
protected  void analyzeEvents(EventSet set)
          Perform various connection actions based on certain events from the VM.
protected  void displayThreads()
           
 boolean fireEvents(long timeout)
          Pulls the next EventSet off the queue, and fires all the registered listeners for each event.
protected  void fireList(ArrayList list, Event e)
          Fire all listeners in the given list.
 EventRequestManager getRequestManager()
           
 void removeEventListener(Class event, JpdaEventListener l)
          Deregister the given listener from the events of the given class.
 void removeEventListener(EventRequest request, JpdaEventListener l)
          Deregister the given listener for the given request.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

registry

private HashMap registry

erm

private EventRequestManager erm

queue

private EventQueue queue

vm

private VirtualMachine vm

set

private EventSet set
Constructor Detail

JpdaEventRegistry

public JpdaEventRegistry(VirtualMachine vm)
Create a new registry.
Method Detail

getRequestManager

public EventRequestManager getRequestManager()

addEventListener

public void addEventListener(EventRequest request,
                             JpdaEventListener l)
Register a listener with the given request.
Throws:
IllegalArgumentException - thrown if either argument is null.

removeEventListener

public void removeEventListener(EventRequest request,
                                JpdaEventListener l)
Deregister the given listener for the given request.
Throws:
IllegalArgumentException - thrown if either argument is null, or if the listener is not registered with the event.

addEventListener

public void addEventListener(Class event,
                             JpdaEventListener l)
Register the given listener to be fired every time an event of the given class is generated.
Throws:
IllegalArgumentException - thrown if either argument is null, or if the event class is not a subclass of Event.

removeEventListener

public void removeEventListener(Class event,
                                JpdaEventListener l)
Deregister the given listener from the events of the given class.
Throws:
IllegalArgumentException - thrown if either argument is null, or if the listener is not registered with the event.

fireEvents

public boolean fireEvents(long timeout)
                   throws InterruptedException
Pulls the next EventSet off the queue, and fires all the registered listeners for each event. This is specially designed such that the remote VM does not run except when the events are being polled. If you manually adjust ThreadReference resume() and suspend(), then your millage may vary.
Parameters:
timeout - the time (in milliseconds) to wait for polling for an event before it returns. If a timeout does occur, the method will return false.
Returns:
true when an event was captured within the timeout framework, or false if a timeout occured without an event being fired.

analyzeEvents

protected void analyzeEvents(EventSet set)
Perform various connection actions based on certain events from the VM.

fireList

protected void fireList(ArrayList list,
                        Event e)
Fire all listeners in the given list.

displayThreads

protected void displayThreads()


Written under the LGPL