8343378: Exceptions in javax/management DeadLockTest.java do not cause test failure
Reviewed-by: amenkov
This commit is contained in:
parent
8d4d589fc5
commit
4a70c83bd0
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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) {
|
public static void main(String[] args) {
|
||||||
System.out.println(">>> test on a client notification deadlock.");
|
System.out.println(">>> test on a client notification deadlock.");
|
||||||
|
|
||||||
boolean ok = true;
|
boolean fail = false;
|
||||||
for (int i = 0; i < protocols.length; i++) {
|
for (int i = 0; i < protocols.length; i++) {
|
||||||
try {
|
try {
|
||||||
test(protocols[i]);
|
test(protocols[i]);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
fail = true; // any one protocol failure, fails the test
|
||||||
System.out.println(">>> Test failed for " + protocols[i]);
|
System.out.println(">>> Test failed for " + protocols[i]);
|
||||||
e.printStackTrace(System.out);
|
e.printStackTrace(System.out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fail) {
|
||||||
|
throw new RuntimeException("FAILED");
|
||||||
|
}
|
||||||
System.out.println(">>> Test passed");
|
System.out.println(">>> Test passed");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void test(String proto)
|
private static void test(String proto) throws Exception {
|
||||||
throws Exception {
|
|
||||||
System.out.println(">>> Test for protocol " + proto);
|
System.out.println(">>> Test for protocol " + proto);
|
||||||
|
|
||||||
JMXServiceURL u = null;
|
JMXServiceURL u = null;
|
||||||
@ -78,6 +80,7 @@ public class DeadLockTest {
|
|||||||
server = JMXConnectorServerFactory.newJMXConnectorServer(u, env, mbs);
|
server = JMXConnectorServerFactory.newJMXConnectorServer(u, env, mbs);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
System.out.println(">>> Skipping unsupported URL " + proto);
|
System.out.println(">>> Skipping unsupported URL " + proto);
|
||||||
|
return; // skip testing this protocol
|
||||||
}
|
}
|
||||||
|
|
||||||
server.start();
|
server.start();
|
||||||
@ -101,10 +104,10 @@ public class DeadLockTest {
|
|||||||
// which should be closed by the server.
|
// which should be closed by the server.
|
||||||
conn.getDefaultDomain();
|
conn.getDefaultDomain();
|
||||||
|
|
||||||
// allow the listner to have time to work
|
// allow the listener to have time to work
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
|
|
||||||
// get a closed notif, should no block.
|
// get a closed notif, should not block.
|
||||||
client.close();
|
client.close();
|
||||||
Thread.sleep(100);
|
Thread.sleep(100);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user