Overview | Package | Class | Use | Tree | Index | Help
| Java Debug Interface
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.jdi.request
Interface EventRequest

All Superinterfaces:
  Mirror

All Known Subinterfaces:
  AccessWatchpointRequest, BreakpointRequest, ClassPrepareRequest, ClassUnloadRequest, ExceptionRequest, MethodEntryRequest, MethodExitRequest, ModificationWatchpointRequest, StepRequest, ThreadDeathRequest, ThreadStartRequest, WatchpointRequest

public interface EventRequest
extends Mirror

Represents a request for notification of an event. Examples include `BreakpointRequest` and `ExceptionRequest`. When an event occurs for which an enabled request is present, an `EventSet` will be placed on the `EventQueue`. The collection of existing event requests is managed by the `EventRequestManager`

The number of events generated for an event request can be controlled through filters. Filters provide additional constraints that an event must satisfy before it is placed the event queue. Filters are added to an event one at a time only while the event is disabled. Each filter is applied to an event in the order it was added to the request. Only events that satisfy all filters are placed in the event queue. Depending on the event request, the following filters may be available:

- Thread filters allow control over the thread for which events are generated.
- Class filters allow control over the class in which the event occurs.
- Count filters allow control over the number of times an event is reported.

Filters can dramatically improve debugger performance by reducing the amount of event traffic sent from the target VM to the debugger VM.

Since:
  1.3
See Also:
  `BreakpointEvent`, `EventQueue`, `EventRequestManager`

Field Summary
`static int` | `SUSPEND_ALL` Suspend all threads when the event occurs
`static int` | `SUSPEND_EVENT_THREAD` Suspend only the thread which generated the event when the event occurs
`static int` | `SUSPEND_NONE` Suspend no threads when the event occurs

Method Summary
`void` | `addCountFilter(int count)` Limit the requested event to be reported at most once after a given number of occurrences.
`void` | `disable()` Same as setEnabled(false).
`void` | `enable()` Same as setEnabled(true).
`Object` | `getProperty(Object key)` Returns the value of the property with the specified key.
`boolean` | `isEnabled()` Determines if this event request is currently enabled.
`void` | `putProperty(Object key, Object value)` Add an arbitrary key/value "property" to this request.
`void` | `setEnabled(boolean val)` Enables or disables this event request.
`void` | `setSuspendPolicy(int policy)` Determines the threads to suspend when the requested event occurs in the target VM.
`int` | `suspendPolicy()` Returns a value which describes the threads to suspend when the requested event occurs in the target VM.

Methods inherited from interface com.sun.jdi.Mirror
`toString, virtualMachine`

Field Detail

### SUSPEND_NONE

    public static final int SUSPEND_NONE

  Suspend no threads when the event occurs

### SUSPEND_EVENT_THREAD

    public static final int SUSPEND_EVENT_THREAD

  Suspend only the thread which generated the event when the event occurs

### SUSPEND_ALL

    public static final int SUSPEND_ALL

  Suspend all threads when the event occurs

Method Detail

### isEnabled

    public boolean isEnabled()

  Determines if this event request is currently enabled.
  Returns:
    `true` if enabled; false otherwise.

### setEnabled

    public void setEnabled(boolean val)

  Enables or disables this event request. While this event request is disabled, the event request will be ignored and the target VM will not be stopped if any of its threads reaches the event request. Disabled event requests still exist, and are included in event request lists such as `EventRequestManager.breakpointRequests()`.
  Parameters:
    `val` - `true` if the event request is to be enabled; `false` otherwise.

### enable

    public void enable()

  Same as setEnabled(true).

### disable

    public void disable()

  Same as setEnabled(false).

### addCountFilter

    public void addCountFilter(int count)

  Limit the requested event to be reported at most once after a given number of occurrences. The event is not reported the first `count - 1` times this filter is reached. To request a one-off event, call this method with a count of 1.

  Once the count reaches 0, any subsequent filters in this request are applied. If none of those filters cause the event to be suppressed, the event is reported. Otherwise, the event is not reported. In either case subsequent events are never reported for this request.

  Parameters:
    `count` - the number of ocurrences before generating an event.
  Throws:
    `InvalidRequestStateException` - if this request is currently enabled. Filters may be added only to disabled requests.

### setSuspendPolicy

    public void setSuspendPolicy(int policy)

  Determines the threads to suspend when the requested event occurs in the target VM. Use `SUSPEND_ALL` to suspend all threads in the target VM (the default). Use `SUSPEND_EVENT_THREAD` to suspend only the thread which generated the event. Use `SUSPEND_NONE` to suspend no threads.

  Thread suspensions through events have the same functionality as explicitly requested suspensions. See `ThreadReference.suspend()` and `VirtualMachine.suspend()` for details.

  Parameters:
    `mode` - the selected suspend mode.

### suspendPolicy

    public int suspendPolicy()

  Returns a value which describes the threads to suspend when the requested event occurs in the target VM. The returned value is `SUSPEND_ALL`, `SUSPEND_EVENT_THREAD`, or `SUSPEND_NONE`.
  Returns:
    the current suspend mode for this request

### putProperty

    public void putProperty(Object key,
                            Object value)

  Add an arbitrary key/value "property" to this request. The property can be used by a client of the JDI to associate application information with the request; These client-set properties are not used internally by the JDI.

  The `get/putProperty`methods provide access to a small per-instance map. This is not to be confused with `java.util.Properties`.``

  If value is null this method will remove the property.

  See Also:
    `getProperty(java.lang.Object)`

### getProperty

    public Object getProperty(Object key)

  Returns the value of the property with the specified key. Only properties added with `putProperty(java.lang.Object, java.lang.Object)` will return a non-null value.
  Returns:
    the value of this property or null
  See Also:
    `putProperty(java.lang.Object, java.lang.Object)`

Overview | Package | Class | Use | Tree | Index | Help
| Java Debug Interface
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD