11/*
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.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -46,21 +46,23 @@ public class DeadLockTest {
4646 public static void main (String [] args ) {
4747 System .out .println (">>> test on a client notification deadlock." );
4848
49- boolean ok = true ;
49+ boolean fail = false ;
5050 for (int i = 0 ; i < protocols .length ; i ++) {
5151 try {
5252 test (protocols [i ]);
5353 } catch (Exception e ) {
54+ fail = true ; // any one protocol failure, fails the test
5455 System .out .println (">>> Test failed for " + protocols [i ]);
5556 e .printStackTrace (System .out );
5657 }
5758 }
58-
59+ if (fail ) {
60+ throw new RuntimeException ("FAILED" );
61+ }
5962 System .out .println (">>> Test passed" );
6063 }
6164
62- private static void test (String proto )
63- throws Exception {
65+ private static void test (String proto ) throws Exception {
6466 System .out .println (">>> Test for protocol " + proto );
6567
6668 JMXServiceURL u = null ;
@@ -78,6 +80,7 @@ private static void test(String proto)
7880 server = JMXConnectorServerFactory .newJMXConnectorServer (u , env , mbs );
7981 } catch (MalformedURLException e ) {
8082 System .out .println (">>> Skipping unsupported URL " + proto );
83+ return ; // skip testing this protocol
8184 }
8285
8386 server .start ();
@@ -101,10 +104,10 @@ private static void test(String proto)
101104 // which should be closed by the server.
102105 conn .getDefaultDomain ();
103106
104- // allow the listner to have time to work
107+ // allow the listener to have time to work
105108 Thread .sleep (100 );
106109
107- // get a closed notif, should no block.
110+ // get a closed notif, should not block.
108111 client .close ();
109112 Thread .sleep (100 );
110113
0 commit comments