01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdi.internal.event;
11:
12: import java.io.DataInputStream;
13: import java.io.IOException;
14:
15: import org.eclipse.jdi.internal.LocationImpl;
16: import org.eclipse.jdi.internal.MirrorImpl;
17: import org.eclipse.jdi.internal.ObjectReferenceImpl;
18: import org.eclipse.jdi.internal.ThreadReferenceImpl;
19: import org.eclipse.jdi.internal.ValueImpl;
20: import org.eclipse.jdi.internal.VirtualMachineImpl;
21: import org.eclipse.jdi.internal.request.RequestID;
22:
23: import com.sun.jdi.BooleanValue;
24: import com.sun.jdi.ObjectReference;
25: import com.sun.jdi.event.MonitorWaitedEvent;
26:
27: /**
28: * This class provides an implementation of MonitorContendedEnterEvent according to Sun's
29: * 1.6 specs
30: * @since 3.3
31: */
32: public class MonitorWaitedEventImpl extends LocatableEventImpl
33: 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,
46: RequestID requestID) {
47: super ("MonitorWaited", vmImpl, requestID); //$NON-NLS-1$
48: }
49:
50: /**
51: * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
52: */
53: public static MonitorWaitedEventImpl read(MirrorImpl target,
54: RequestID requestID, DataInputStream dataInStream)
55: throws IOException {
56: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
57: MonitorWaitedEventImpl event = new MonitorWaitedEventImpl(
58: vmImpl, requestID);
59: event.fThreadRef = ThreadReferenceImpl.read(target,
60: dataInStream);
61: event.fMonitor = ObjectReferenceImpl.readObjectRefWithTag(
62: target, dataInStream);
63: event.fLocation = LocationImpl.read(target, dataInStream);
64: event.fTimedOut = ((BooleanValue) ValueImpl.readWithTag(target,
65: dataInStream)).value();
66: return event;
67: }
68:
69: /* (non-Javadoc)
70: * @see com.sun.jdi.event.MonitorWaitedEvent#monitor()
71: */
72: public ObjectReference monitor() {
73: return fMonitor;
74: }
75:
76: /* (non-Javadoc)
77: * @see com.sun.jdi.event.MonitorWaitedEvent#timedout()
78: */
79: public boolean timedout() {
80: return fTimedOut;
81: }
82:
83: }
|