Sample VmListener for responding to state changes in the running application
Definition at line 24 of file SampleVmServiceListener.java.
◆ SampleVmServiceListener()
org.dartlang.vm.service.SampleVmServiceListener.SampleVmServiceListener |
( |
Set< EventKind > |
ignoreAll | ) |
|
|
inlinepackage |
◆ connectionClosed()
void org.dartlang.vm.service.SampleVmServiceListener.connectionClosed |
( |
| ) |
|
|
inline |
◆ connectionOpened()
void org.dartlang.vm.service.SampleVmServiceListener.connectionOpened |
( |
| ) |
|
|
inline |
◆ received()
void org.dartlang.vm.service.SampleVmServiceListener.received |
( |
String |
streamId, |
|
|
Event |
event |
|
) |
| |
|
inline |
Called when a VM event has been received.
- Parameters
-
Implements org.dartlang.vm.service.VmServiceListener.
Definition at line 40 of file SampleVmServiceListener.java.
40 {
41 synchronized (lock) {
42 if (ignoreAll.contains(
event.getKind())) {
43 return;
44 }
45 if (lastStreamId != null) {
46 unexpectedEvent(lastStreamId, lastEvent);
47 }
48 lastStreamId = streamId;
50 lock.notifyAll();
51 }
52 }
◆ waitFor()
Event org.dartlang.vm.service.SampleVmServiceListener.waitFor |
( |
String |
expectedStreamId, |
|
|
EventKind |
expectedEventKind |
|
) |
| |
|
inline |
Definition at line 59 of file SampleVmServiceListener.java.
59 {
60 long end = System.currentTimeMillis() + 5000;
61 synchronized (lock) {
62 while (true) {
63 if (expectedStreamId.equals(lastStreamId) && expectedEventKind.equals(lastEvent.getKind())) {
64 Event event = lastEvent;
65 lastStreamId = null;
66 lastEvent = null;
68 }
69 long timeout =
end - System.currentTimeMillis();
70 if (timeout <= 0) {
71 break;
72 }
73 try {
74 lock.wait(timeout);
75 } catch (InterruptedException e) {
76
77 }
78 }
79 }
80 throw new RuntimeException("Expected event: " + expectedStreamId + ", " + expectedEventKind);
81 }
The documentation for this class was generated from the following file: