1
1
/*
2
- * Copyright (c) 2004, 2015 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2004, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
@@ -46,21 +46,23 @@ public class DeadLockTest {
46
46
public static void main (String [] args ) {
47
47
System .out .println (">>> test on a client notification deadlock." );
48
48
49
- boolean ok = true ;
49
+ boolean fail = false ;
50
50
for (int i = 0 ; i < protocols .length ; i ++) {
51
51
try {
52
52
test (protocols [i ]);
53
53
} catch (Exception e ) {
54
+ fail = true ; // any one protocol failure, fails the test
54
55
System .out .println (">>> Test failed for " + protocols [i ]);
55
56
e .printStackTrace (System .out );
56
57
}
57
58
}
58
-
59
+ if (fail ) {
60
+ throw new RuntimeException ("FAILED" );
61
+ }
59
62
System .out .println (">>> Test passed" );
60
63
}
61
64
62
- private static void test (String proto )
63
- throws Exception {
65
+ private static void test (String proto ) throws Exception {
64
66
System .out .println (">>> Test for protocol " + proto );
65
67
66
68
JMXServiceURL u = null ;
@@ -78,6 +80,7 @@ private static void test(String proto)
78
80
server = JMXConnectorServerFactory .newJMXConnectorServer (u , env , mbs );
79
81
} catch (MalformedURLException e ) {
80
82
System .out .println (">>> Skipping unsupported URL " + proto );
83
+ return ; // skip testing this protocol
81
84
}
82
85
83
86
server .start ();
@@ -101,10 +104,10 @@ private static void test(String proto)
101
104
// which should be closed by the server.
102
105
conn .getDefaultDomain ();
103
106
104
- // allow the listner to have time to work
107
+ // allow the listener to have time to work
105
108
Thread .sleep (100 );
106
109
107
- // get a closed notif, should no block.
110
+ // get a closed notif, should not block.
108
111
client .close ();
109
112
Thread .sleep (100 );
110
113
0 commit comments