1 /*
2 * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
123 synchronized (eventRequestSpecs) {
124 eventRequestSpecs.remove(ers);
125 }
126 if (request != null) {
127 request.virtualMachine().eventRequestManager()
128 .deleteEventRequest(request);
129 }
130 notifyDeleted(ers);
131 //### notify delete - here?
132 }
133
134 List<EventRequestSpec> eventRequestSpecs() {
135 // We need to make a copy to avoid synchronization problems
136 synchronized (eventRequestSpecs) {
137 return new ArrayList<EventRequestSpec>(eventRequestSpecs);
138 }
139 }
140
141 // -------- notify routines --------------------
142
143 @SuppressWarnings("unchecked")
144 private Vector<SpecListener> specListeners() {
145 return (Vector<SpecListener>)runtime.specListeners.clone();
146 }
147
148 void notifySet(EventRequestSpec spec) {
149 Vector<SpecListener> l = specListeners();
150 SpecEvent evt = new SpecEvent(spec);
151 for (int i = 0; i < l.size(); i++) {
152 spec.notifySet(l.elementAt(i), evt);
153 }
154 }
155
156 void notifyDeferred(EventRequestSpec spec) {
157 Vector<SpecListener> l = specListeners();
158 SpecEvent evt = new SpecEvent(spec);
159 for (int i = 0; i < l.size(); i++) {
160 spec.notifyDeferred(l.elementAt(i), evt);
161 }
162 }
163
164 void notifyDeleted(EventRequestSpec spec) {
165 Vector<SpecListener> l = specListeners();
166 SpecEvent evt = new SpecEvent(spec);
167 for (int i = 0; i < l.size(); i++) {
168 spec.notifyDeleted(l.elementAt(i), evt);
169 }
170 }
171
172 void notifyResolved(EventRequestSpec spec) {
173 Vector<SpecListener> l = specListeners();
174 SpecEvent evt = new SpecEvent(spec);
175 for (int i = 0; i < l.size(); i++) {
176 spec.notifyResolved(l.elementAt(i), evt);
177 }
178 }
179
180 void notifyError(EventRequestSpec spec, Exception exc) {
181 Vector<SpecListener> l = specListeners();
182 SpecErrorEvent evt = new SpecErrorEvent(spec, exc);
183 for (int i = 0; i < l.size(); i++) {
184 spec.notifyError(l.elementAt(i), evt);
185 }
186 }
187 }
|
1 /*
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
123 synchronized (eventRequestSpecs) {
124 eventRequestSpecs.remove(ers);
125 }
126 if (request != null) {
127 request.virtualMachine().eventRequestManager()
128 .deleteEventRequest(request);
129 }
130 notifyDeleted(ers);
131 //### notify delete - here?
132 }
133
134 List<EventRequestSpec> eventRequestSpecs() {
135 // We need to make a copy to avoid synchronization problems
136 synchronized (eventRequestSpecs) {
137 return new ArrayList<EventRequestSpec>(eventRequestSpecs);
138 }
139 }
140
141 // -------- notify routines --------------------
142
143 private ArrayList<SpecListener> specListeners() {
144 return runtime.specListeners.clone();
145 }
146
147 void notifySet(EventRequestSpec spec) {
148 List<SpecListener> l = specListeners();
149 SpecEvent evt = new SpecEvent(spec);
150 for (int i = 0; i < l.size(); i++) {
151 spec.notifySet(l.get(i), evt);
152 }
153 }
154
155 void notifyDeferred(EventRequestSpec spec) {
156 List<SpecListener> l = specListeners();
157 SpecEvent evt = new SpecEvent(spec);
158 for (int i = 0; i < l.size(); i++) {
159 spec.notifyDeferred(l.get(i), evt);
160 }
161 }
162
163 void notifyDeleted(EventRequestSpec spec) {
164 List<SpecListener> l = specListeners();
165 SpecEvent evt = new SpecEvent(spec);
166 for (int i = 0; i < l.size(); i++) {
167 spec.notifyDeleted(l.get(i), evt);
168 }
169 }
170
171 void notifyResolved(EventRequestSpec spec) {
172 List<SpecListener> l = specListeners();
173 SpecEvent evt = new SpecEvent(spec);
174 for (int i = 0; i < l.size(); i++) {
175 spec.notifyResolved(l.get(i), evt);
176 }
177 }
178
179 void notifyError(EventRequestSpec spec, Exception exc) {
180 List<SpecListener> l = specListeners();
181 SpecErrorEvent evt = new SpecErrorEvent(spec, exc);
182 for (int i = 0; i < l.size(); i++) {
183 spec.notifyError(l.get(i), evt);
184 }
185 }
186 }
|