8335632: jdk/jfr/api/consumer/streaming/TestJVMExit.java failed with "Process [...] is no longer alive"
Reviewed-by: mgronlun
This commit is contained in:
parent
7efe16038e
commit
b83766e590
@ -34,12 +34,29 @@ import jdk.jfr.consumer.EventStream;
|
|||||||
* @requires vm.hasJFR
|
* @requires vm.hasJFR
|
||||||
* @library /test/lib /test/jdk
|
* @library /test/lib /test/jdk
|
||||||
* @modules jdk.jfr jdk.attach java.base/jdk.internal.misc
|
* @modules jdk.jfr jdk.attach java.base/jdk.internal.misc
|
||||||
|
* @build jdk.jfr.api.consumer.streaming.TestProcess
|
||||||
*
|
*
|
||||||
* @run main/othervm -Dsun.tools.attach.attachTimeout=100000 jdk.jfr.api.consumer.streaming.TestJVMExit
|
* @run main/othervm -Dsun.tools.attach.attachTimeout=100000 jdk.jfr.api.consumer.streaming.TestJVMExit
|
||||||
*/
|
*/
|
||||||
public class TestJVMExit {
|
public class TestJVMExit {
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
while (true) {
|
||||||
|
try {
|
||||||
|
testExit();
|
||||||
|
return;
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
String message = String.valueOf(e.getMessage());
|
||||||
|
// If the test application crashes during startup, retry.
|
||||||
|
if (!message.contains("is no longer alive")) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
System.out.println("Application not alive when trying to get repository. Retrying.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void testExit() throws Exception {
|
||||||
try (TestProcess process = new TestProcess("exit-application")) {
|
try (TestProcess process = new TestProcess("exit-application")) {
|
||||||
AtomicInteger eventCounter = new AtomicInteger();
|
AtomicInteger eventCounter = new AtomicInteger();
|
||||||
try (EventStream es = EventStream.openRepository(process.getRepository())) {
|
try (EventStream es = EventStream.openRepository(process.getRepository())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user