Source Code Cross Referenced for EventRequestManagerImpl.java in  » IDE-Eclipse » jdt » org » eclipse » jdi » internal » request » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Eclipse » jdt » org.eclipse.jdi.internal.request 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Copyright (c) 2000, 2006 IBM Corporation and others.
003:         * All rights reserved. This program and the accompanying materials
004:         * are made available under the terms of the Eclipse Public License v1.0
005:         * which accompanies this distribution, and is available at
006:         * http://www.eclipse.org/legal/epl-v10.html
007:         *
008:         * Contributors:
009:         *     IBM Corporation - initial API and implementation
010:         *******************************************************************************/package org.eclipse.jdi.internal.request;
011:
012:        import java.util.ArrayList;
013:        import java.util.Enumeration;
014:        import java.util.HashSet;
015:        import java.util.Hashtable;
016:        import java.util.Iterator;
017:        import java.util.List;
018:
019:        import org.eclipse.jdi.internal.FieldImpl;
020:        import org.eclipse.jdi.internal.LocationImpl;
021:        import org.eclipse.jdi.internal.MirrorImpl;
022:        import org.eclipse.jdi.internal.ReferenceTypeImpl;
023:        import org.eclipse.jdi.internal.ThreadReferenceImpl;
024:        import org.eclipse.jdi.internal.VirtualMachineImpl;
025:        import org.eclipse.jdi.internal.event.AccessWatchpointEventImpl;
026:        import org.eclipse.jdi.internal.event.BreakpointEventImpl;
027:        import org.eclipse.jdi.internal.event.ClassPrepareEventImpl;
028:        import org.eclipse.jdi.internal.event.ClassUnloadEventImpl;
029:        import org.eclipse.jdi.internal.event.EventImpl;
030:        import org.eclipse.jdi.internal.event.ExceptionEventImpl;
031:        import org.eclipse.jdi.internal.event.MethodEntryEventImpl;
032:        import org.eclipse.jdi.internal.event.MethodExitEventImpl;
033:        import org.eclipse.jdi.internal.event.ModificationWatchpointEventImpl;
034:        import org.eclipse.jdi.internal.event.MonitorContendedEnterEventImpl;
035:        import org.eclipse.jdi.internal.event.MonitorContendedEnteredEventImpl;
036:        import org.eclipse.jdi.internal.event.MonitorWaitEventImpl;
037:        import org.eclipse.jdi.internal.event.MonitorWaitedEventImpl;
038:        import org.eclipse.jdi.internal.event.StepEventImpl;
039:        import org.eclipse.jdi.internal.event.ThreadDeathEventImpl;
040:        import org.eclipse.jdi.internal.event.ThreadStartEventImpl;
041:        import org.eclipse.jdi.internal.event.VMDeathEventImpl;
042:
043:        import com.ibm.icu.text.MessageFormat;
044:        import com.sun.jdi.Field;
045:        import com.sun.jdi.Location;
046:        import com.sun.jdi.ObjectCollectedException;
047:        import com.sun.jdi.ReferenceType;
048:        import com.sun.jdi.ThreadReference;
049:        import com.sun.jdi.VMMismatchException;
050:        import com.sun.jdi.request.AccessWatchpointRequest;
051:        import com.sun.jdi.request.BreakpointRequest;
052:        import com.sun.jdi.request.ClassPrepareRequest;
053:        import com.sun.jdi.request.ClassUnloadRequest;
054:        import com.sun.jdi.request.DuplicateRequestException;
055:        import com.sun.jdi.request.EventRequest;
056:        import com.sun.jdi.request.EventRequestManager;
057:        import com.sun.jdi.request.ExceptionRequest;
058:        import com.sun.jdi.request.InvalidRequestStateException;
059:        import com.sun.jdi.request.MethodEntryRequest;
060:        import com.sun.jdi.request.MethodExitRequest;
061:        import com.sun.jdi.request.ModificationWatchpointRequest;
062:        import com.sun.jdi.request.MonitorContendedEnterRequest;
063:        import com.sun.jdi.request.MonitorContendedEnteredRequest;
064:        import com.sun.jdi.request.MonitorWaitRequest;
065:        import com.sun.jdi.request.MonitorWaitedRequest;
066:        import com.sun.jdi.request.StepRequest;
067:        import com.sun.jdi.request.ThreadDeathRequest;
068:        import com.sun.jdi.request.ThreadStartRequest;
069:        import com.sun.jdi.request.VMDeathRequest;
070:
071:        /**
072:         * this class implements the corresponding interfaces
073:         * declared by the JDI specification. See the com.sun.jdi package
074:         * for more information.
075:         *
076:         */
077:        public class EventRequestManagerImpl extends MirrorImpl implements 
078:                EventRequestManager, org.eclipse.jdi.hcr.EventRequestManager {
079:            /** Indexes used in arrays of request types. */
080:            private static final int ACCESS_WATCHPOINT_INDEX = 0;
081:            private static final int BREAKPOINT_INDEX = 1;
082:            private static final int CLASS_PREPARE_INDEX = 2;
083:            private static final int CLASS_UNLOAD_INDEX = 3;
084:            private static final int EXCEPTION_INDEX = 4;
085:            private static final int METHOD_ENTRY_INDEX = 5;
086:            private static final int METHOD_EXIT_INDEX = 6;
087:            private static final int MODIFICATION_WATCHPOINT_INDEX = 7;
088:            private static final int STEP_INDEX = 8;
089:            private static final int THREAD_DEATH_INDEX = 9;
090:            private static final int THREAD_START_INDEX = 10;
091:            private static final int VM_DEATH_INDEX = 11;
092:            private static final int MONITOR_CONTENDED_ENTERED_INDEX = 12;
093:            private static final int MONITOR_CONTENDED_ENTER_INDEX = 13;
094:            private static final int MONITOR_WAITED_INDEX = 14;
095:            private static final int MONITOR_WAIT_INDEX = 15;
096:
097:            /** Set of all existing requests per request type. */
098:            private HashSet[] fRequests;
099:
100:            /** Maps per request type of requestIDs to enabled requests. */
101:            private Hashtable[] fEnabledRequests;
102:
103:            /**
104:             * Creates new EventRequestManager.
105:             */
106:            public EventRequestManagerImpl(VirtualMachineImpl vmImpl) {
107:                super ("EventRequestManager", vmImpl); //$NON-NLS-1$
108:
109:                // Initialize list of requests.
110:                fRequests = new HashSet[MONITOR_WAIT_INDEX + 1];
111:                for (int i = 0; i < fRequests.length; i++)
112:                    fRequests[i] = new HashSet();
113:
114:                // Initialize map of request IDs to enabled requests.
115:                fEnabledRequests = new Hashtable[MONITOR_WAIT_INDEX + 1];
116:                for (int i = 0; i < fEnabledRequests.length; i++)
117:                    fEnabledRequests[i] = new Hashtable();
118:            }
119:
120:            /**
121:             * Creates AccessWatchpointRequest.
122:             */
123:            public AccessWatchpointRequest createAccessWatchpointRequest(
124:                    Field field) {
125:                FieldImpl fieldImpl = (FieldImpl) field;
126:                AccessWatchpointRequestImpl req = new AccessWatchpointRequestImpl(
127:                        virtualMachineImpl());
128:                req.addFieldFilter(fieldImpl);
129:                addEventRequest(ACCESS_WATCHPOINT_INDEX, req);
130:                return req;
131:            }
132:
133:            /**
134:             * Creates BreakpointRequest.
135:             */
136:            public BreakpointRequest createBreakpointRequest(Location location)
137:                    throws VMMismatchException {
138:                LocationImpl locImpl = (LocationImpl) location;
139:                BreakpointRequestImpl req = new BreakpointRequestImpl(
140:                        virtualMachineImpl());
141:                req.addLocationFilter(locImpl);
142:                addEventRequest(BREAKPOINT_INDEX, req);
143:                return req;
144:            }
145:
146:            /**
147:             * Creates ClassPrepareRequest.
148:             */
149:            public ClassPrepareRequest createClassPrepareRequest() {
150:                ClassPrepareRequestImpl req = new ClassPrepareRequestImpl(
151:                        virtualMachineImpl());
152:                addEventRequest(CLASS_PREPARE_INDEX, req);
153:                return req;
154:            }
155:
156:            /**
157:             * Creates ClassUnloadRequest.
158:             */
159:            public ClassUnloadRequest createClassUnloadRequest() {
160:                ClassUnloadRequestImpl req = new ClassUnloadRequestImpl(
161:                        virtualMachineImpl());
162:                addEventRequest(CLASS_UNLOAD_INDEX, req);
163:                return req;
164:            }
165:
166:            /**
167:             * Creates ExceptionRequest.
168:             */
169:            public ExceptionRequest createExceptionRequest(
170:                    ReferenceType refType, boolean notifyCaught,
171:                    boolean notifyUncaught) {
172:                ReferenceTypeImpl refTypeImpl = (ReferenceTypeImpl) refType;
173:                ExceptionRequestImpl req = new ExceptionRequestImpl(
174:                        virtualMachineImpl());
175:                req.addExceptionFilter(refTypeImpl, notifyCaught,
176:                        notifyUncaught);
177:                addEventRequest(EXCEPTION_INDEX, req);
178:                return req;
179:            }
180:
181:            /**
182:             * Creates MethodEntryRequest.
183:             */
184:            public MethodEntryRequest createMethodEntryRequest() {
185:                MethodEntryRequestImpl req = new MethodEntryRequestImpl(
186:                        virtualMachineImpl());
187:                addEventRequest(METHOD_ENTRY_INDEX, req);
188:                return req;
189:            }
190:
191:            /**
192:             * Creates MethodExitRequest.
193:             */
194:            public MethodExitRequest createMethodExitRequest() {
195:                MethodExitRequestImpl req = new MethodExitRequestImpl(
196:                        virtualMachineImpl());
197:                addEventRequest(METHOD_EXIT_INDEX, req);
198:                return req;
199:            }
200:
201:            /**
202:             * Creates a MonitorContendedEnteredRequest
203:             * @since 3.3
204:             */
205:            public MonitorContendedEnteredRequest createMonitorContendedEnteredRequest() {
206:                MonitorContendedEnteredRequestImpl req = new MonitorContendedEnteredRequestImpl(
207:                        virtualMachineImpl());
208:                addEventRequest(MONITOR_CONTENDED_ENTERED_INDEX, req);
209:                return req;
210:            }
211:
212:            /**
213:             * Creates a MonitorContendedEnterRequest
214:             * @since 3.3
215:             */
216:            public MonitorContendedEnterRequest createMonitorContendedEnterRequest() {
217:                MonitorContendedEnterRequestImpl req = new MonitorContendedEnterRequestImpl(
218:                        virtualMachineImpl());
219:                addEventRequest(MONITOR_CONTENDED_ENTER_INDEX, req);
220:                return req;
221:            }
222:
223:            /**
224:             * Creates a MonitorWaitedRequest
225:             * @since 3.3
226:             */
227:            public MonitorWaitedRequest createMonitorWaitedRequest() {
228:                MonitorWaitedRequestImpl req = new MonitorWaitedRequestImpl(
229:                        virtualMachineImpl());
230:                addEventRequest(MONITOR_WAITED_INDEX, req);
231:                return req;
232:            }
233:
234:            /**
235:             * Creates a MonitorWaitRequest
236:             * @since 3.3
237:             */
238:            public MonitorWaitRequest createMonitorWaitRequest() {
239:                MonitorWaitRequestImpl req = new MonitorWaitRequestImpl(
240:                        virtualMachineImpl());
241:                addEventRequest(MONITOR_WAIT_INDEX, req);
242:                return req;
243:            }
244:
245:            /**
246:             * Creates ModificationWatchpointRequest.
247:             */
248:            public ModificationWatchpointRequest createModificationWatchpointRequest(
249:                    Field field) {
250:                FieldImpl fieldImpl = (FieldImpl) field;
251:                ModificationWatchpointRequestImpl req = new ModificationWatchpointRequestImpl(
252:                        virtualMachineImpl());
253:                req.addFieldFilter(fieldImpl);
254:                addEventRequest(MODIFICATION_WATCHPOINT_INDEX, req);
255:                return req;
256:            }
257:
258:            /**
259:             * Creates StepRequest.
260:             */
261:            public StepRequest createStepRequest(ThreadReference thread,
262:                    int size, int depth) throws DuplicateRequestException,
263:                    ObjectCollectedException {
264:                ThreadReferenceImpl threadImpl = (ThreadReferenceImpl) thread;
265:                StepRequestImpl req = new StepRequestImpl(virtualMachineImpl());
266:                req.addStepFilter(threadImpl, size, depth);
267:                addEventRequest(STEP_INDEX, req);
268:                return req;
269:            }
270:
271:            /**
272:             * Creates ThreadDeathRequest.
273:             */
274:            public ThreadDeathRequest createThreadDeathRequest() {
275:                ThreadDeathRequestImpl req = new ThreadDeathRequestImpl(
276:                        virtualMachineImpl());
277:                addEventRequest(THREAD_DEATH_INDEX, req);
278:                return req;
279:            }
280:
281:            /**
282:             * Creates ThreadStartRequest.
283:             */
284:            public ThreadStartRequest createThreadStartRequest() {
285:                ThreadStartRequestImpl req = new ThreadStartRequestImpl(
286:                        virtualMachineImpl());
287:                addEventRequest(THREAD_START_INDEX, req);
288:                return req;
289:            }
290:
291:            /*
292:             * @see EventRequestManager#createVMDeathRequest()
293:             */
294:            public VMDeathRequest createVMDeathRequest() {
295:                VMDeathRequestImpl req = new VMDeathRequestImpl(
296:                        virtualMachineImpl());
297:                addEventRequest(VM_DEATH_INDEX, req);
298:                return req;
299:            }
300:
301:            /**
302:             * Creates ReenterStepRequest (for OTI specific Hot Code Replacement).
303:             */
304:            public org.eclipse.jdi.hcr.ReenterStepRequest createReenterStepRequest(
305:                    ThreadReference thread) {
306:                virtualMachineImpl().checkHCRSupported();
307:                ThreadReferenceImpl threadImpl = (ThreadReferenceImpl) thread;
308:                ReenterStepRequestImpl req = new ReenterStepRequestImpl(
309:                        virtualMachineImpl());
310:                // Note that the StepFilter is only used to specify the thread.
311:                // The size is ignored and the depth will always be writter as HCR_STEP_DEPTH_REENTER_JDWP.
312:                req.addStepFilter(threadImpl, StepRequest.STEP_MIN, 0);
313:                // Since this is a special case of a step request, we use the same request list.
314:                addEventRequest(STEP_INDEX, req);
315:                return req;
316:            }
317:
318:            /**
319:             * Enables class prepare requests for all loaded classes.  This is
320:             * necessary for current versions of the KVM to function correctly.
321:             * This method is only called when the remote VM is determined to be
322:             * the KVM.
323:             */
324:            public void enableInternalClassPrepareEvent() {
325:                // Note that these requests are not stored in the set of outstanding requests because
326:                // they must be invisible from outside.
327:                ClassPrepareRequestImpl requestPrepare = new ClassPrepareRequestImpl(
328:                        virtualMachineImpl());
329:                requestPrepare.setGeneratedInside();
330:                requestPrepare.setSuspendPolicy(EventRequest.SUSPEND_NONE);
331:
332:                requestPrepare.enable();
333:            }
334:
335:            /**
336:             * Creates ClassUnloadRequest for maintaining class information for within JDI.
337:             * Needed to known when to flush the cache.
338:             */
339:            public void enableInternalClasUnloadEvent(/* tbd: ReferenceTypeImpl refType*/) {
340:                // Note that these requests are not stored in the set of outstanding requests because
341:                // they must be invisible from outside.
342:                ClassUnloadRequestImpl reqUnload = new ClassUnloadRequestImpl(
343:                        virtualMachineImpl());
344:                reqUnload.setGeneratedInside();
345:                // tbd: It is now yet possible to only ask for unload events for
346:                // classes that we know of due to a limitation in the J9 VM.
347:                // reqUnload.addClassFilter(refType);
348:                reqUnload.setSuspendPolicy(EventRequest.SUSPEND_NONE);
349:                reqUnload.enable();
350:            }
351:
352:            /**
353:             * Checks if a steprequest is for the given thread is already enabled.
354:             */
355:            boolean existsEnabledStepRequest(ThreadReferenceImpl threadImpl) {
356:                Enumeration enumeration = fEnabledRequests[STEP_INDEX]
357:                        .elements();
358:                StepRequestImpl step;
359:                while (enumeration.hasMoreElements()) {
360:                    step = (StepRequestImpl) enumeration.nextElement();
361:                    if (step.thread() == threadImpl)
362:                        return true;
363:                }
364:                return false;
365:            }
366:
367:            /**
368:             * Deletes all Breakpoints.
369:             */
370:            public void deleteAllBreakpoints() {
371:                EventRequestImpl.clearAllBreakpoints(this );
372:                fRequests[BREAKPOINT_INDEX].clear();
373:                fEnabledRequests[BREAKPOINT_INDEX].clear();
374:            }
375:
376:            /**
377:             * Adds an EventRequests to the given list.
378:             */
379:            public void addEventRequest(int index, EventRequest req) {
380:                fRequests[index].add(req);
381:            }
382:
383:            /**
384:             * Deletes an EventRequest.
385:             */
386:            private void deleteEventRequest(int index, EventRequest req)
387:                    throws VMMismatchException {
388:                // Remove request from list of requests and from the mapping of requestIDs to requests.
389:                checkVM(req);
390:                EventRequestImpl requestImpl = (EventRequestImpl) req;
391:                fRequests[index].remove(requestImpl);
392:                if (requestImpl.requestID() != null)
393:                    fEnabledRequests[index].remove(requestImpl.requestID());
394:            }
395:
396:            /**
397:             * Deletes an EventRequest.
398:             */
399:            public void deleteEventRequest(EventRequest req) {
400:                // Disable request, note that this also causes the event request to be removed from fEnabledRequests.
401:                try {
402:                    req.disable();
403:                } catch (InvalidRequestStateException exception) {
404:                    // The event has already been removed from the VM.
405:                }
406:
407:                // Remove request from list.
408:                if (req instanceof  AccessWatchpointRequestImpl)
409:                    deleteEventRequest(ACCESS_WATCHPOINT_INDEX, req);
410:                else if (req instanceof  BreakpointRequestImpl)
411:                    deleteEventRequest(BREAKPOINT_INDEX, req);
412:                else if (req instanceof  ClassPrepareRequestImpl)
413:                    deleteEventRequest(CLASS_PREPARE_INDEX, req);
414:                else if (req instanceof  ClassUnloadRequestImpl)
415:                    deleteEventRequest(CLASS_UNLOAD_INDEX, req);
416:                else if (req instanceof  ExceptionRequestImpl)
417:                    deleteEventRequest(EXCEPTION_INDEX, req);
418:                else if (req instanceof  MethodEntryRequestImpl)
419:                    deleteEventRequest(METHOD_ENTRY_INDEX, req);
420:                else if (req instanceof  MethodExitRequestImpl)
421:                    deleteEventRequest(METHOD_EXIT_INDEX, req);
422:                else if (req instanceof  ModificationWatchpointRequestImpl)
423:                    deleteEventRequest(MODIFICATION_WATCHPOINT_INDEX, req);
424:                else if (req instanceof  StepRequestImpl)
425:                    deleteEventRequest(STEP_INDEX, req);
426:                else if (req instanceof  ThreadDeathRequestImpl)
427:                    deleteEventRequest(THREAD_DEATH_INDEX, req);
428:                else if (req instanceof  ThreadStartRequestImpl)
429:                    deleteEventRequest(THREAD_START_INDEX, req);
430:                else if (req instanceof  MonitorContendedEnterRequestImpl) {
431:                    deleteEventRequest(MONITOR_CONTENDED_ENTER_INDEX, req);
432:                } else if (req instanceof  MonitorContendedEnteredRequestImpl) {
433:                    deleteEventRequest(MONITOR_CONTENDED_ENTERED_INDEX, req);
434:                } else if (req instanceof  MonitorWaitRequestImpl) {
435:                    deleteEventRequest(MONITOR_WAIT_INDEX, req);
436:                } else if (req instanceof  MonitorWaitedRequestImpl) {
437:                    deleteEventRequest(MONITOR_WAITED_INDEX, req);
438:                } else
439:
440:                    throw new InternalError(
441:                            MessageFormat
442:                                    .format(
443:                                            RequestMessages.EventRequestManagerImpl_EventRequest_type_of__0__is_unknown_1,
444:                                            new String[] { req.toString() }));
445:            }
446:
447:            /**
448:             * Deletes all EventRequests from the given list.
449:             */
450:            public void deleteEventRequests(List requests)
451:                    throws VMMismatchException {
452:                Iterator iter = requests.iterator();
453:                while (iter.hasNext()) {
454:                    Object obj = iter.next();
455:                    deleteEventRequest((EventRequest) obj);
456:                }
457:            }
458:
459:            /**
460:             * @return Returns list of AccessWatchpointRequests.
461:             * For changes, the appropriate EventRequestManager methods should be used.
462:             */
463:            public List accessWatchpointRequests() {
464:                return new ArrayList(fRequests[ACCESS_WATCHPOINT_INDEX]);
465:            }
466:
467:            /**
468:             * @return Returns list of BreakpointRequests.
469:             * For changes, the appropriate EventRequestManager methods should be used.
470:             */
471:            public List breakpointRequests() {
472:                return new ArrayList(fRequests[BREAKPOINT_INDEX]);
473:            }
474:
475:            /**
476:             * @return Returns list of ClassPrepareRequests.
477:             * For changes, the appropriate EventRequestManager methods should be used.
478:             */
479:            public List classPrepareRequests() {
480:                return new ArrayList(fRequests[CLASS_PREPARE_INDEX]);
481:            }
482:
483:            /**
484:             * @return Returns list of ClassUnloadRequests.
485:             * For changes, the appropriate EventRequestManager methods should be used.
486:             */
487:            public List classUnloadRequests() {
488:                return new ArrayList(fRequests[CLASS_UNLOAD_INDEX]);
489:            }
490:
491:            /**
492:             * @return Returns list of ExceptionRequests.
493:             * For changes, the appropriate EventRequestManager methods should be used.
494:             */
495:            public List exceptionRequests() {
496:                return new ArrayList(fRequests[EXCEPTION_INDEX]);
497:            }
498:
499:            /**
500:             * @return Returns list of MethodEntryRequests.
501:             * For changes, the appropriate EventRequestManager methods should be used.
502:             */
503:            public List methodEntryRequests() {
504:                return new ArrayList(fRequests[METHOD_ENTRY_INDEX]);
505:            }
506:
507:            /**
508:             * @return Returns list of MethodExitRequests.
509:             * For changes, the appropriate EventRequestManager methods should be used.
510:             */
511:            public List methodExitRequests() {
512:                return new ArrayList(fRequests[METHOD_EXIT_INDEX]);
513:            }
514:
515:            /**
516:             * @return Returns list of ModificationWatchpointRequests.
517:             * For changes, the appropriate EventRequestManager methods should be used.
518:             */
519:            public List modificationWatchpointRequests() {
520:                return new ArrayList(fRequests[MODIFICATION_WATCHPOINT_INDEX]);
521:            }
522:
523:            /**
524:             * @return Returns list of StepRequests.
525:             * For changes, the appropriate EventRequestManager methods should be used.
526:             */
527:            public List stepRequests() {
528:                return new ArrayList(fRequests[STEP_INDEX]);
529:            }
530:
531:            /**
532:             * @return Returns list of ThreadDeathRequests.
533:             * For changes, the appropriate EventRequestManager methods should be used.
534:             */
535:            public List threadDeathRequests() {
536:                return new ArrayList(fRequests[THREAD_DEATH_INDEX]);
537:            }
538:
539:            /**
540:             * @return Returns list of ThreadStartRequests.
541:             * For changes, the appropriate EventRequestManager methods should be used.
542:             */
543:            public List threadStartRequests() {
544:                return new ArrayList(fRequests[THREAD_START_INDEX]);
545:            }
546:
547:            /**
548:             * @return Returns list of VMDeathRequests.
549:             * For changes, the appropriate EventRequestManager methods should be used.
550:             */
551:            public List vmDeathRequests() {
552:                return new ArrayList(fRequests[VM_DEATH_INDEX]);
553:            }
554:
555:            public void removeRequestIDMapping(EventRequestImpl req) {
556:                if (req instanceof  AccessWatchpointRequestImpl)
557:                    fEnabledRequests[ACCESS_WATCHPOINT_INDEX].remove(req
558:                            .requestID());
559:                else if (req instanceof  BreakpointRequestImpl)
560:                    fEnabledRequests[BREAKPOINT_INDEX].remove(req.requestID());
561:                else if (req instanceof  ClassPrepareRequestImpl)
562:                    fEnabledRequests[CLASS_PREPARE_INDEX].remove(req
563:                            .requestID());
564:                else if (req instanceof  ClassUnloadRequestImpl)
565:                    fEnabledRequests[CLASS_UNLOAD_INDEX]
566:                            .remove(req.requestID());
567:                else if (req instanceof  ExceptionRequestImpl)
568:                    fEnabledRequests[EXCEPTION_INDEX].remove(req.requestID());
569:                else if (req instanceof  MethodEntryRequestImpl)
570:                    fEnabledRequests[METHOD_ENTRY_INDEX]
571:                            .remove(req.requestID());
572:                else if (req instanceof  MethodExitRequestImpl)
573:                    fEnabledRequests[METHOD_EXIT_INDEX].remove(req.requestID());
574:                else if (req instanceof  ModificationWatchpointRequestImpl)
575:                    fEnabledRequests[MODIFICATION_WATCHPOINT_INDEX].remove(req
576:                            .requestID());
577:                else if (req instanceof  StepRequestImpl)
578:                    fEnabledRequests[STEP_INDEX].remove(req.requestID());
579:                else if (req instanceof  ThreadDeathRequestImpl)
580:                    fEnabledRequests[THREAD_DEATH_INDEX]
581:                            .remove(req.requestID());
582:                else if (req instanceof  ThreadStartRequestImpl)
583:                    fEnabledRequests[THREAD_START_INDEX]
584:                            .remove(req.requestID());
585:                else if (req instanceof  MonitorContendedEnterRequestImpl) {
586:                    fEnabledRequests[MONITOR_CONTENDED_ENTER_INDEX].remove(req
587:                            .requestID());
588:                } else if (req instanceof  MonitorContendedEnteredRequestImpl) {
589:                    fEnabledRequests[MONITOR_CONTENDED_ENTERED_INDEX]
590:                            .remove(req.requestID());
591:                } else if (req instanceof  MonitorWaitRequestImpl) {
592:                    fEnabledRequests[MONITOR_WAIT_INDEX]
593:                            .remove(req.requestID());
594:                } else if (req instanceof  MonitorWaitedRequestImpl) {
595:                    fEnabledRequests[MONITOR_WAITED_INDEX].remove(req
596:                            .requestID());
597:                }
598:            }
599:
600:            /**
601:             * Maps a request ID to requests.
602:             */
603:            public void addRequestIDMapping(EventRequestImpl req) {
604:                if (req instanceof  AccessWatchpointRequestImpl)
605:                    fEnabledRequests[ACCESS_WATCHPOINT_INDEX].put(req
606:                            .requestID(), req);
607:                else if (req instanceof  BreakpointRequestImpl)
608:                    fEnabledRequests[BREAKPOINT_INDEX]
609:                            .put(req.requestID(), req);
610:                else if (req instanceof  ClassPrepareRequestImpl)
611:                    fEnabledRequests[CLASS_PREPARE_INDEX].put(req.requestID(),
612:                            req);
613:                else if (req instanceof  ClassUnloadRequestImpl)
614:                    fEnabledRequests[CLASS_UNLOAD_INDEX].put(req.requestID(),
615:                            req);
616:                else if (req instanceof  ExceptionRequestImpl)
617:                    fEnabledRequests[EXCEPTION_INDEX].put(req.requestID(), req);
618:                else if (req instanceof  MethodEntryRequestImpl)
619:                    fEnabledRequests[METHOD_ENTRY_INDEX].put(req.requestID(),
620:                            req);
621:                else if (req instanceof  MethodExitRequestImpl)
622:                    fEnabledRequests[METHOD_EXIT_INDEX].put(req.requestID(),
623:                            req);
624:                else if (req instanceof  ModificationWatchpointRequestImpl)
625:                    fEnabledRequests[MODIFICATION_WATCHPOINT_INDEX].put(req
626:                            .requestID(), req);
627:                else if (req instanceof  StepRequestImpl)
628:                    fEnabledRequests[STEP_INDEX].put(req.requestID(), req);
629:                else if (req instanceof  ThreadDeathRequestImpl)
630:                    fEnabledRequests[THREAD_DEATH_INDEX].put(req.requestID(),
631:                            req);
632:                else if (req instanceof  ThreadStartRequestImpl)
633:                    fEnabledRequests[THREAD_START_INDEX].put(req.requestID(),
634:                            req);
635:                else if (req instanceof  MonitorWaitRequestImpl) {
636:                    fEnabledRequests[MONITOR_WAIT_INDEX].put(req.requestID(),
637:                            req);
638:                } else if (req instanceof  MonitorWaitedRequestImpl) {
639:                    fEnabledRequests[MONITOR_WAITED_INDEX].put(req.requestID(),
640:                            req);
641:                } else if (req instanceof  MonitorContendedEnterRequestImpl) {
642:                    fEnabledRequests[MONITOR_CONTENDED_ENTER_INDEX].put(req
643:                            .requestID(), req);
644:                } else if (req instanceof  MonitorContendedEnteredRequestImpl) {
645:                    fEnabledRequests[MONITOR_CONTENDED_ENTERED_INDEX].put(req
646:                            .requestID(), req);
647:                }
648:            }
649:
650:            /**
651:             * Find Request that matches event.
652:             */
653:            public EventRequestImpl findRequest(EventImpl event) {
654:                if (event instanceof  AccessWatchpointEventImpl)
655:                    return (EventRequestImpl) fEnabledRequests[ACCESS_WATCHPOINT_INDEX]
656:                            .get(event.requestID());
657:                else if (event instanceof  BreakpointEventImpl)
658:                    return (EventRequestImpl) fEnabledRequests[BREAKPOINT_INDEX]
659:                            .get(event.requestID());
660:                else if (event instanceof  ClassPrepareEventImpl)
661:                    return (ClassPrepareRequestImpl) fEnabledRequests[CLASS_PREPARE_INDEX]
662:                            .get(event.requestID());
663:                else if (event instanceof  ClassUnloadEventImpl)
664:                    return (EventRequestImpl) fEnabledRequests[CLASS_UNLOAD_INDEX]
665:                            .get(event.requestID());
666:                else if (event instanceof  ExceptionEventImpl)
667:                    return (EventRequestImpl) fEnabledRequests[EXCEPTION_INDEX]
668:                            .get(event.requestID());
669:                else if (event instanceof  MethodEntryEventImpl)
670:                    return (EventRequestImpl) fEnabledRequests[METHOD_ENTRY_INDEX]
671:                            .get(event.requestID());
672:                else if (event instanceof  MethodExitEventImpl)
673:                    return (EventRequestImpl) fEnabledRequests[METHOD_EXIT_INDEX]
674:                            .get(event.requestID());
675:                else if (event instanceof  ModificationWatchpointEventImpl)
676:                    return (EventRequestImpl) fEnabledRequests[MODIFICATION_WATCHPOINT_INDEX]
677:                            .get(event.requestID());
678:                else if (event instanceof  StepEventImpl)
679:                    return (EventRequestImpl) fEnabledRequests[STEP_INDEX]
680:                            .get(event.requestID());
681:                else if (event instanceof  ThreadDeathEventImpl)
682:                    return (EventRequestImpl) fEnabledRequests[THREAD_DEATH_INDEX]
683:                            .get(event.requestID());
684:                else if (event instanceof  ThreadStartEventImpl)
685:                    return (EventRequestImpl) fEnabledRequests[THREAD_START_INDEX]
686:                            .get(event.requestID());
687:                else if (event instanceof  VMDeathEventImpl)
688:                    return (EventRequestImpl) fEnabledRequests[VM_DEATH_INDEX]
689:                            .get(event.requestID());
690:                else if (event instanceof  MonitorWaitEventImpl) {
691:                    return (EventRequestImpl) fEnabledRequests[MONITOR_WAIT_INDEX]
692:                            .get(event.requestID());
693:                } else if (event instanceof  MonitorWaitedEventImpl) {
694:                    return (EventRequestImpl) fEnabledRequests[MONITOR_WAITED_INDEX]
695:                            .get(event.requestID());
696:                } else if (event instanceof  MonitorContendedEnterEventImpl) {
697:                    return (EventRequestImpl) fEnabledRequests[MONITOR_CONTENDED_ENTER_INDEX]
698:                            .get(event.requestID());
699:                } else if (event instanceof  MonitorContendedEnteredEventImpl) {
700:                    return (EventRequestImpl) fEnabledRequests[MONITOR_CONTENDED_ENTERED_INDEX]
701:                            .get(event.requestID());
702:                } else
703:                    throw new InternalError(
704:                            RequestMessages.EventRequestManagerImpl_Got_event_of_unknown_type_2);
705:            }
706:
707:            /**
708:             * @see com.sun.jdi.request.EventRequestManager#monitorContendedEnterRequests()
709:             * @since 3.3
710:             */
711:            public List monitorContendedEnterRequests() {
712:                return new ArrayList(fRequests[MONITOR_CONTENDED_ENTER_INDEX]);
713:            }
714:
715:            /**
716:             * @see com.sun.jdi.request.EventRequestManager#monitorContendedEnteredRequests()
717:             * @since 3.3
718:             */
719:            public List monitorContendedEnteredRequests() {
720:                return new ArrayList(fRequests[MONITOR_CONTENDED_ENTERED_INDEX]);
721:            }
722:
723:            /**
724:             * @see com.sun.jdi.request.EventRequestManager#monitorWaitRequests()
725:             * @since 3.3
726:             */
727:            public List monitorWaitRequests() {
728:                return new ArrayList(fRequests[MONITOR_WAIT_INDEX]);
729:            }
730:
731:            /**
732:             * @see com.sun.jdi.request.EventRequestManager#monitorWaitedRequests()
733:             * @since 3.3
734:             */
735:            public List monitorWaitedRequests() {
736:                return new ArrayList(fRequests[MONITOR_WAITED_INDEX]);
737:            }
738:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.