/** The 'refType' is known to match, return the EventRequest. */
 EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException {
   Field field = refType.fieldByName(fieldId);
   EventRequestManager em = refType.virtualMachine().eventRequestManager();
   EventRequest wp = em.createAccessWatchpointRequest(field);
   wp.setSuspendPolicy(suspendPolicy);
   wp.enable();
   return wp;
 }
Ejemplo n.º 2
0
    EventDestination destination() {
      /*
       * We need to decide if this event is for
       * 1. an internal request
       * 2. a client request that is no longer available, ie
       *    it has been deleted, or disabled and re-enabled
       *    which gives it a new ID.
       * 3. a current client request that is disabled
       * 4. a current enabled client request.
       *
       * We will filter this set into a set
       * that contains only 1s for our internal queue
       * and a set that contains only 4s for our client queue.
       * If we get an EventSet that contains only 2 and 3
       * then we have to resume it if it is not SUSPEND_NONE
       * because no one else will.
       */
      if (requestID == 0) {
        /* An unsolicited event.  These have traditionally
         * been treated as client events.
         */
        return EventDestination.CLIENT_EVENT;
      }

      // Is this an event for a current client request?
      if (request == null) {
        // Nope.  Is it an event for an internal request?
        EventRequestManagerImpl ermi = this.vm.getInternalEventRequestManager();
        if (ermi.request(eventCmd, requestID) != null) {
          // Yep
          return EventDestination.INTERNAL_EVENT;
        }
        return EventDestination.UNKNOWN_EVENT;
      }

      // We found a client request
      if (request.isEnabled()) {
        return EventDestination.CLIENT_EVENT;
      }
      return EventDestination.UNKNOWN_EVENT;
    }