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.LongValue;
24: import com.sun.jdi.ObjectReference;
25: import com.sun.jdi.event.MonitorWaitEvent;
26:
27: public class MonitorWaitEventImpl extends LocatableEventImpl implements
28: MonitorWaitEvent {
29:
30: /** Jdwp event kind id **/
31: public static final byte EVENT_KIND = EVENT_MONITOR_WAIT;
32:
33: /** howl ong the timeout is **/
34: private long fTimeOut;
35:
36: /** the monitor reference **/
37: private ObjectReference fMonitor;
38:
39: /** Constructor **/
40: private MonitorWaitEventImpl(VirtualMachineImpl vmImpl,
41: RequestID requestID) {
42: super ("MonitorWait", vmImpl, requestID); //$NON-NLS-1$
43: }
44:
45: /**
46: * @return Creates, reads and returns new EventImpl, of which requestID has already been read.
47: */
48: public static MonitorWaitEventImpl read(MirrorImpl target,
49: RequestID requestID, DataInputStream dataInStream)
50: throws IOException {
51: VirtualMachineImpl vmImpl = target.virtualMachineImpl();
52: MonitorWaitEventImpl event = new MonitorWaitEventImpl(vmImpl,
53: requestID);
54: event.fThreadRef = ThreadReferenceImpl.read(target,
55: dataInStream);
56: event.fMonitor = ObjectReferenceImpl.readObjectRefWithTag(
57: target, dataInStream);
58: event.fLocation = LocationImpl.read(target, dataInStream);
59: event.fTimeOut = ((LongValue) ValueImpl.readWithTag(target,
60: dataInStream)).value();
61: return event;
62: }
63:
64: /* (non-Javadoc)
65: * @see com.sun.jdi.event.MonitorWaitedEvent#monitor()
66: */
67: public ObjectReference monitor() {
68: return fMonitor;
69: }
70:
71: /* (non-Javadoc)
72: * @see com.sun.jdi.event.MonitorWaitEvent#timeout()
73: */
74: public long timeout() {
75: return fTimeOut;
76: }
77: }
|