KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdi > internal > event > MonitorWaitedEventImpl


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdi.internal.event;
12
13 import java.io.DataInputStream JavaDoc;
14 import java.io.IOException JavaDoc;
15
16 import org.eclipse.jdi.internal.LocationImpl;
17 import org.eclipse.jdi.internal.MirrorImpl;
18 import org.eclipse.jdi.internal.ObjectReferenceImpl;
19 import org.eclipse.jdi.internal.ThreadReferenceImpl;
20 import org.eclipse.jdi.internal.ValueImpl;
21 import org.eclipse.jdi.internal.VirtualMachineImpl;
22 import org.eclipse.jdi.internal.request.RequestID;
23
24 import com.sun.jdi.BooleanValue;
25 import com.sun.jdi.ObjectReference;
26 import com.sun.jdi.event.MonitorWaitedEvent;
27
28 /**
29  * This class provides an implementation of MonitorContendedEnterEvent according to Sun's
30  * 1.6 specs
31  * @since 3.3
32  */

33 public class MonitorWaitedEventImpl extends LocatableEventImpl implements MonitorWaitedEvent {
34
35     /** Jdwp event id **/
36     public static final byte EVENT_KIND = EVENT_MONITOR_WAITED;
37     
38     /** if the wait timed out or not **/
39     private boolean fTimedOut;
40     
41     /** the monitor reference **/
42     private ObjectReference fMonitor;
43     
44     /** Constructor **/
45     private MonitorWaitedEventImpl(VirtualMachineImpl vmImpl, RequestID requestID) {
46         super("MonitorWaited", vmImpl, requestID); //$NON-NLS-1$
47
}
48     
49     /**
50      * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
51      */

52     public static MonitorWaitedEventImpl read(MirrorImpl target, RequestID requestID, DataInputStream JavaDoc dataInStream) throws IOException JavaDoc {
53         VirtualMachineImpl vmImpl = target.virtualMachineImpl();
54         MonitorWaitedEventImpl event = new MonitorWaitedEventImpl(vmImpl, requestID);
55         event.fThreadRef = ThreadReferenceImpl.read(target, dataInStream);
56         event.fMonitor = ObjectReferenceImpl.readObjectRefWithTag(target, dataInStream);
57         event.fLocation = LocationImpl.read(target, dataInStream);
58         event.fTimedOut = ((BooleanValue)ValueImpl.readWithTag(target, dataInStream)).value();
59         return event;
60     }
61     
62     /* (non-Javadoc)
63      * @see com.sun.jdi.event.MonitorWaitedEvent#monitor()
64      */

65     public ObjectReference monitor() {
66         return fMonitor;
67     }
68     
69     /* (non-Javadoc)
70      * @see com.sun.jdi.event.MonitorWaitedEvent#timedout()
71      */

72     public boolean timedout() {
73         return fTimedOut;
74     }
75
76 }
77
Popular Tags