8343378: Exceptions in javax/management DeadLockTest.java do not cause test failure

Reviewed-by: amenkov
This commit is contained in:
Kevin Walls 2024-11-01 08:35:28 +00:00
parent 8d4d589fc5
commit 4a70c83bd0

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,21 +46,23 @@ public class DeadLockTest {
public static void main(String[] args) {
System.out.println(">>> test on a client notification deadlock.");
boolean ok = true;
boolean fail = false;
for (int i = 0; i < protocols.length; i++) {
try {
test(protocols[i]);
} catch (Exception e) {
fail = true; // any one protocol failure, fails the test
System.out.println(">>> Test failed for " + protocols[i]);
e.printStackTrace(System.out);
}
}
if (fail) {
throw new RuntimeException("FAILED");
}
System.out.println(">>> Test passed");
}
private static void test(String proto)
throws Exception {
private static void test(String proto) throws Exception {
System.out.println(">>> Test for protocol " + proto);
JMXServiceURL u = null;
@ -78,6 +80,7 @@ public class DeadLockTest {
server = JMXConnectorServerFactory.newJMXConnectorServer(u, env, mbs);
} catch (MalformedURLException e) {
System.out.println(">>> Skipping unsupported URL " + proto);
return; // skip testing this protocol
}
server.start();
@ -101,10 +104,10 @@ public class DeadLockTest {
// which should be closed by the server.
conn.getDefaultDomain();
// allow the listner to have time to work
// allow the listener to have time to work
Thread.sleep(100);
// get a closed notif, should no block.
// get a closed notif, should not block.
client.close();
Thread.sleep(100);