equal
deleted
inserted
replaced
25 package jdk.jfr.api.consumer.streaming; |
25 package jdk.jfr.api.consumer.streaming; |
26 |
26 |
27 import java.io.IOException; |
27 import java.io.IOException; |
28 import java.io.RandomAccessFile; |
28 import java.io.RandomAccessFile; |
29 import java.nio.file.Files; |
29 import java.nio.file.Files; |
|
30 import java.nio.file.NoSuchFileException; |
30 import java.nio.file.Path; |
31 import java.nio.file.Path; |
31 import java.nio.file.Paths; |
32 import java.nio.file.Paths; |
32 import java.util.Properties; |
33 import java.util.Properties; |
33 |
34 |
34 import jdk.internal.misc.Unsafe; |
35 import jdk.internal.misc.Unsafe; |
41 * Class that emits a NUMBER_OF_EVENTS and then awaits crash or exit |
42 * Class that emits a NUMBER_OF_EVENTS and then awaits crash or exit |
42 * |
43 * |
43 * Requires jdk.attach module. |
44 * Requires jdk.attach module. |
44 * |
45 * |
45 */ |
46 */ |
46 public final class TestProcess { |
47 public final class TestProcess implements AutoCloseable { |
47 |
48 |
48 private static class TestEvent extends Event { |
49 private static class TestEvent extends Event { |
49 } |
50 } |
50 |
51 |
51 public final static int NUMBER_OF_EVENTS = 10; |
52 public final static int NUMBER_OF_EVENTS = 10; |
133 } |
134 } |
134 |
135 |
135 public long pid() { |
136 public long pid() { |
136 return process.pid(); |
137 return process.pid(); |
137 } |
138 } |
|
139 |
|
140 @Override |
|
141 public void close() throws Exception { |
|
142 try { |
|
143 if (path != null) { |
|
144 Files.delete(path); |
|
145 } |
|
146 } catch(NoSuchFileException nfe) { |
|
147 // ignore |
|
148 } |
|
149 } |
|
150 |
|
151 public void awaitDeath() { |
|
152 while (process.isAlive()) { |
|
153 takeNap(); |
|
154 } |
|
155 } |
138 } |
156 } |