Commit 9898e839 by Keith Seitz Committed by Keith Seitz

Jdwp.class: Regenerated.

        * classpath/lib/gnu/classpath/jdwp/Jdwp.class: Regenerated.
        * classpath/lib/gnu/classpath/jdwp/event/EventManager.class:
        Regenerated.
        * gnu/classpath/jdwp/event/EventManager.h: Regenerated.

        * gnu/classpath/jdwp/event/EventManager.java
        (getEventRequest): Rename to...
        (getEventRequests): ...this.
        Change return type to array of requests.
        Construct a list of all matching events and return
        them all.
        * gnu/classpath/jdwp/Jdwp.java (notify): Use getEventRequests
        and send event notifications for all matching requests.

From-SVN: r124250
parent e91ada38
2007-04-27 Keith Seitz <keiths@redhat.com> 2007-04-27 Keith Seitz <keiths@redhat.com>
* classpath/lib/gnu/classpath/jdwp/Jdwp.class: Regenerated.
* classpath/lib/gnu/classpath/jdwp/event/EventManager.class:
Regenerated.
* gnu/classpath/jdwp/event/EventManager.h: Regenerated.
2007-04-27 Keith Seitz <keiths@redhat.com>
* classpath/lib/gnu/classpath/jdwp/event/filters/ * classpath/lib/gnu/classpath/jdwp/event/filters/
LocationOnlyFilter.class: Regenerated; LocationOnlyFilter.class: Regenerated;
* classpath/lib/gnu/classpath/jdwp/util/Location.class: * classpath/lib/gnu/classpath/jdwp/util/Location.class:
......
2007-04-27 Keith Seitz <keiths@redhat.com> 2007-04-27 Keith Seitz <keiths@redhat.com>
* gnu/classpath/jdwp/event/EventManager.java
(getEventRequest): Rename to...
(getEventRequests): ...this.
Change return type to array of requests.
Construct a list of all matching events and return
them all.
* gnu/classpath/jdwp/Jdwp.java (notify): Use getEventRequests
and send event notifications for all matching requests.
2007-04-27 Keith Seitz <keiths@redhat.com>
* gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java * gnu/classpath/jdwp/event/filters/LocationOnlyFilter.java
(matches): Use Location.equals to determine equality. (matches): Use Location.equals to determine equality.
* gnu/classpath/jdwp/VMMethod.java (equals): * gnu/classpath/jdwp/VMMethod.java (equals):
/* Jdwp.java -- Virtual machine to JDWP back-end programming interface /* Jdwp.java -- Virtual machine to JDWP back-end programming interface
Copyright (C) 2005, 2006 Free Software Foundation Copyright (C) 2005, 2006, 2007 Free Software Foundation
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -207,23 +207,22 @@ public class Jdwp ...@@ -207,23 +207,22 @@ public class Jdwp
* The event is filtered through the event manager before being * The event is filtered through the event manager before being
* sent. * sent.
* *
* FIXME: Probably need logic to send multiple events * FIXME: Probably need logic to send multiple (different) events
* @param event the event to report * @param event the event to report
*/ */
public static void notify (Event event) public static void notify(Event event)
{ {
Jdwp jdwp = getDefault (); Jdwp jdwp = getDefault();
if (jdwp != null) if (jdwp != null)
{ {
EventManager em = EventManager.getDefault (); EventManager em = EventManager.getDefault();
EventRequest request = em.getEventRequest (event); EventRequest[] requests = em.getEventRequests(event);
if (request != null) for (int i = 0; i < requests.length; ++i)
{ {
try try
{ {
System.out.println ("Jdwp.notify: sending event " + event); sendEvent(requests[i], event);
sendEvent (request, event); jdwp._enforceSuspendPolicy(requests[i].getSuspendPolicy());
jdwp._enforceSuspendPolicy (request.getSuspendPolicy ());
} }
catch (Exception e) catch (Exception e)
{ {
......
...@@ -44,6 +44,7 @@ import gnu.classpath.jdwp.VMVirtualMachine; ...@@ -44,6 +44,7 @@ import gnu.classpath.jdwp.VMVirtualMachine;
import gnu.classpath.jdwp.exception.InvalidEventTypeException; import gnu.classpath.jdwp.exception.InvalidEventTypeException;
import gnu.classpath.jdwp.exception.JdwpException; import gnu.classpath.jdwp.exception.JdwpException;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
...@@ -146,39 +147,39 @@ public class EventManager ...@@ -146,39 +147,39 @@ public class EventManager
} }
/** /**
* Returns a request for the given event. This method will only * Returns all requests for the given event. This method will only
* be used if the <code>EventManager</code> is handling event filtering. * be used if the <code>EventManager</code> is handling event filtering.
* *
* @param event the event * @param event the event
* @return request that was interested in this event * @return requests that are interested in this event
* or <code>null</code> if none (and event should not be sent) * or <code>null</code> if none (and event should not be sent)
* @throws IllegalArgumentException for invalid event kind * @throws IllegalArgumentException for invalid event kind
*/ */
public EventRequest getEventRequest (Event event) public EventRequest[] getEventRequests(Event event)
{ {
EventRequest interestedRequest = null; ArrayList interestedEvents = new ArrayList();
Hashtable requests; Hashtable requests;
Byte kind = new Byte (event.getEventKind ()); Byte kind = new Byte(event.getEventKind());
requests = (Hashtable) _requests.get (kind); requests = (Hashtable) _requests.get(kind);
if (requests == null) if (requests == null)
{ {
// Did not get a valid event type // Did not get a valid event type
throw new IllegalArgumentException ("invalid event kind: " + kind); throw new IllegalArgumentException("invalid event kind: " + kind);
} }
boolean match = false;
// Loop through the requests. Must look at ALL requests in order // Loop through the requests. Must look at ALL requests in order
// to evaluate all filters (think count filter). // to evaluate all filters (think count filter).
// TODO: What if multiple matches? Spec isn't so clear on this. Iterator rIter = requests.values().iterator();
Iterator rIter = requests.values().iterator (); while (rIter.hasNext())
while (rIter.hasNext ())
{ {
EventRequest request = (EventRequest) rIter.next (); EventRequest request = (EventRequest) rIter.next();
if (request.matches (event)) if (request.matches(event))
interestedRequest = request; interestedEvents.add(request);
} }
return interestedRequest; EventRequest[] r = new EventRequest[interestedEvents.size()];
interestedEvents.toArray(r);
return r;
} }
/** /**
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#pragma interface #pragma interface
#include <java/lang/Object.h> #include <java/lang/Object.h>
#include <gcj/array.h>
extern "Java" extern "Java"
{ {
namespace gnu namespace gnu
...@@ -34,7 +36,7 @@ public: ...@@ -34,7 +36,7 @@ public:
private: private:
EventManager(); EventManager();
public: public:
virtual ::gnu::classpath::jdwp::event::EventRequest * getEventRequest(::gnu::classpath::jdwp::event::Event *); virtual JArray< ::gnu::classpath::jdwp::event::EventRequest * > * getEventRequests(::gnu::classpath::jdwp::event::Event *);
virtual void requestEvent(::gnu::classpath::jdwp::event::EventRequest *); virtual void requestEvent(::gnu::classpath::jdwp::event::EventRequest *);
virtual void deleteRequest(jbyte, jint); virtual void deleteRequest(jbyte, jint);
virtual void clearRequests(jbyte); virtual void clearRequests(jbyte);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment