44 * Filters are added to an event one at a time only while the event is
45 * disabled. Multiple filters are applied with CUT-OFF AND, in the order
46 * it was added to the request. Only events that satisfy all filters are
47 * placed in the event queue.
48 * <p>
49 * The set of available filters is dependent on the event request,
50 * some examples of filters are:
51 * <ul>
52 * <li>Thread filters allow control over the thread for which events are
53 * generated.
54 * <li>Class filters allow control over the class in which the event
55 * occurs.
56 * <li>Instance filters allow control over the instance in which
57 * the event occurs.
58 * <li>Count filters allow control over the number of times an event
59 * is reported.
60 * </ul>
61 * Filters can dramatically improve debugger performance by reducing the
62 * amount of event traffic sent from the target VM to the debugger VM.
63 * <p>
64 * Any method on <code>EventRequest</code> which
65 * takes <code>EventRequest</code> as an parameter may throw
66 * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
67 * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
68 * available to be read from the {@link com.sun.jdi.event.EventQueue}.
69 * <p>
70 * Any method on <code>EventRequest</code> which
71 * takes <code>EventRequest</code> as an parameter may throw
72 * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
73 *
74 * @see com.sun.jdi.event.BreakpointEvent
75 * @see com.sun.jdi.event.EventQueue
76 * @see EventRequestManager
77 *
78 * @author Robert Field
79 * @since 1.3
80 */
81 @jdk.Exported
82 public interface EventRequest extends Mirror {
83
84 /**
85 * Determines if this event request is currently enabled.
86 *
87 * @return <code>true</code> if enabled;
88 * <code>false</code> otherwise.
89 */
90 boolean isEnabled();
91
92 /**
93 * Enables or disables this event request. While this event request is
94 * disabled, the event request will be ignored and the target VM
95 * will not be stopped if any of its threads reaches the
96 * event request. Disabled event requests still exist,
97 * and are included in event request lists such as
98 * {@link EventRequestManager#breakpointRequests()}.
99 *
100 * @param val <code>true</code> if the event request is to be enabled;
101 * <code>false</code> otherwise.
102 * @throws InvalidRequestStateException if this request
103 * has been deleted.
104 * @throws IllegalThreadStateException if this is a StepRequest,
105 * <code>val</code> is <code>true</code>, and the
106 * thread named in the request has died or is not yet started.
107 */
108 void setEnabled(boolean val);
109
110 /**
111 * Same as {@link #setEnabled <CODE>setEnabled(true)</CODE>}.
112 * @throws InvalidRequestStateException if this request
113 * has been deleted.
114 * @throws IllegalThreadStateException if this is a StepRequest
115 * and the thread named in the request has died or is not yet started.
116 */
117 void enable();
118
119 /**
120 * Same as {@link #setEnabled <CODE>setEnabled(false)</CODE>}.
121 * @throws InvalidRequestStateException if this request
122 * has been deleted.
123 */
124 void disable();
125
126 /**
127 * Limit the requested event to be reported at most once after a
128 * given number of occurrences. The event is not reported
129 * the first <code>count - 1</code> times this filter is reached.
130 * To request a one-off event, call this method with a count of 1.
131 * <p>
132 * Once the count reaches 0, any subsequent filters in this request
133 * are applied. If none of those filters cause the event to be
134 * suppressed, the event is reported. Otherwise, the event is not
135 * reported. In either case subsequent events are never reported for
136 * this request.
137 *
138 * @param count the number of ocurrences before generating an event.
139 * @throws InvalidRequestStateException if this request is currently
140 * enabled or has been deleted.
141 * Filters may be added only to disabled requests.
142 * @throws IllegalArgumentException if <CODE>count</CODE>
143 * is less than one.
144 */
145 void addCountFilter(int count);
146
147 /** Suspend no threads when the event occurs */
148 int SUSPEND_NONE = 0;
149 /** Suspend only the thread which generated the event when the event occurs */
150 int SUSPEND_EVENT_THREAD = 1;
151 /** Suspend all threads when the event occurs */
152 int SUSPEND_ALL = 2;
153
154 /**
155 * Determines the threads to suspend when the requested event occurs
156 * in the target VM. Use {@link #SUSPEND_ALL} to suspend all
157 * threads in the target VM (the default). Use {@link #SUSPEND_EVENT_THREAD}
158 * to suspend only the thread which generated the event. Use
159 * {@link #SUSPEND_NONE} to suspend no threads.
160 * <p>
161 * Thread suspensions through events have the same functionality
162 * as explicitly requested suspensions. See
172 */
173 void setSuspendPolicy(int policy);
174
175 /**
176 * Returns a value which describes the threads to suspend when the
177 * requested event occurs in the target VM.
178 * The returned value is {@link #SUSPEND_ALL},
179 * {@link #SUSPEND_EVENT_THREAD}, or {@link #SUSPEND_NONE}.
180 *
181 * @return the current suspend mode for this request
182 */
183 int suspendPolicy();
184
185 /**
186 * Add an arbitrary key/value "property" to this request.
187 * The property can be used by a client of the JDI to
188 * associate application information with the request;
189 * These client-set properties are not used internally
190 * by the JDI.
191 * <p>
192 * The <code>get/putProperty</code> methods provide access to
193 * a small per-instance map. This is <b>not</b> to be confused
194 * with {@link java.util.Properties}.
195 * <p>
196 * If value is null this method will remove the property.
197 *
198 * @see #getProperty
199 */
200 void putProperty(Object key, Object value);
201
202 /**
203 * Returns the value of the property with the specified key. Only
204 * properties added with {@link #putProperty} will return
205 * a non-null value.
206 *
207 * @return the value of this property or null
208 * @see #putProperty
209 */
210 Object getProperty(Object key);
211 }
|
44 * Filters are added to an event one at a time only while the event is
45 * disabled. Multiple filters are applied with CUT-OFF AND, in the order
46 * it was added to the request. Only events that satisfy all filters are
47 * placed in the event queue.
48 * <p>
49 * The set of available filters is dependent on the event request,
50 * some examples of filters are:
51 * <ul>
52 * <li>Thread filters allow control over the thread for which events are
53 * generated.
54 * <li>Class filters allow control over the class in which the event
55 * occurs.
56 * <li>Instance filters allow control over the instance in which
57 * the event occurs.
58 * <li>Count filters allow control over the number of times an event
59 * is reported.
60 * </ul>
61 * Filters can dramatically improve debugger performance by reducing the
62 * amount of event traffic sent from the target VM to the debugger VM.
63 * <p>
64 * Any method on {@code EventRequest} which
65 * takes {@code EventRequest} as an parameter may throw
66 * {@link com.sun.jdi.VMDisconnectedException} if the target VM is
67 * disconnected and the {@link com.sun.jdi.event.VMDisconnectEvent} has been or is
68 * available to be read from the {@link com.sun.jdi.event.EventQueue}.
69 * <p>
70 * Any method on {@code EventRequest} which
71 * takes {@code EventRequest} as an parameter may throw
72 * {@link com.sun.jdi.VMOutOfMemoryException} if the target VM has run out of memory.
73 *
74 * @see com.sun.jdi.event.BreakpointEvent
75 * @see com.sun.jdi.event.EventQueue
76 * @see EventRequestManager
77 *
78 * @author Robert Field
79 * @since 1.3
80 */
81 @jdk.Exported
82 public interface EventRequest extends Mirror {
83
84 /**
85 * Determines if this event request is currently enabled.
86 *
87 * @return {@code true} if enabled;
88 * {@code false} otherwise.
89 */
90 boolean isEnabled();
91
92 /**
93 * Enables or disables this event request. While this event request is
94 * disabled, the event request will be ignored and the target VM
95 * will not be stopped if any of its threads reaches the
96 * event request. Disabled event requests still exist,
97 * and are included in event request lists such as
98 * {@link EventRequestManager#breakpointRequests()}.
99 *
100 * @param val {@code true} if the event request is to be enabled;
101 * {@code false} otherwise.
102 * @throws InvalidRequestStateException if this request
103 * has been deleted.
104 * @throws IllegalThreadStateException if this is a StepRequest,
105 * {@code val} is {@code true}, and the
106 * thread named in the request has died or is not yet started.
107 */
108 void setEnabled(boolean val);
109
110 /**
111 * Same as {@link #setEnabled setEnabled(true)}.
112 * @throws InvalidRequestStateException if this request
113 * has been deleted.
114 * @throws IllegalThreadStateException if this is a StepRequest
115 * and the thread named in the request has died or is not yet started.
116 */
117 void enable();
118
119 /**
120 * Same as {@link #setEnabled setEnabled(false)}.
121 * @throws InvalidRequestStateException if this request
122 * has been deleted.
123 */
124 void disable();
125
126 /**
127 * Limit the requested event to be reported at most once after a
128 * given number of occurrences. The event is not reported
129 * the first {@code count - 1} times this filter is reached.
130 * To request a one-off event, call this method with a count of 1.
131 * <p>
132 * Once the count reaches 0, any subsequent filters in this request
133 * are applied. If none of those filters cause the event to be
134 * suppressed, the event is reported. Otherwise, the event is not
135 * reported. In either case subsequent events are never reported for
136 * this request.
137 *
138 * @param count the number of ocurrences before generating an event.
139 * @throws InvalidRequestStateException if this request is currently
140 * enabled or has been deleted.
141 * Filters may be added only to disabled requests.
142 * @throws IllegalArgumentException if {@code count}
143 * is less than one.
144 */
145 void addCountFilter(int count);
146
147 /** Suspend no threads when the event occurs */
148 int SUSPEND_NONE = 0;
149 /** Suspend only the thread which generated the event when the event occurs */
150 int SUSPEND_EVENT_THREAD = 1;
151 /** Suspend all threads when the event occurs */
152 int SUSPEND_ALL = 2;
153
154 /**
155 * Determines the threads to suspend when the requested event occurs
156 * in the target VM. Use {@link #SUSPEND_ALL} to suspend all
157 * threads in the target VM (the default). Use {@link #SUSPEND_EVENT_THREAD}
158 * to suspend only the thread which generated the event. Use
159 * {@link #SUSPEND_NONE} to suspend no threads.
160 * <p>
161 * Thread suspensions through events have the same functionality
162 * as explicitly requested suspensions. See
172 */
173 void setSuspendPolicy(int policy);
174
175 /**
176 * Returns a value which describes the threads to suspend when the
177 * requested event occurs in the target VM.
178 * The returned value is {@link #SUSPEND_ALL},
179 * {@link #SUSPEND_EVENT_THREAD}, or {@link #SUSPEND_NONE}.
180 *
181 * @return the current suspend mode for this request
182 */
183 int suspendPolicy();
184
185 /**
186 * Add an arbitrary key/value "property" to this request.
187 * The property can be used by a client of the JDI to
188 * associate application information with the request;
189 * These client-set properties are not used internally
190 * by the JDI.
191 * <p>
192 * The {@code get/putProperty} methods provide access to
193 * a small per-instance map. This is <b>not</b> to be confused
194 * with {@link java.util.Properties}.
195 * <p>
196 * If value is null this method will remove the property.
197 *
198 * @see #getProperty
199 */
200 void putProperty(Object key, Object value);
201
202 /**
203 * Returns the value of the property with the specified key. Only
204 * properties added with {@link #putProperty} will return
205 * a non-null value.
206 *
207 * @return the value of this property or null
208 * @see #putProperty
209 */
210 Object getProperty(Object key);
211 }
|