Skip to content

Commit 1bf7c29

Browse files
committed
8310525: DynamicLauncher for JDP test needs to try harder to find a free port
Backport-of: 59407faf7b6861d142dbc3700a6fa9615567a275
1 parent 56972c6 commit 1bf7c29

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

test/jdk/sun/management/jdp/DynamicLauncher.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 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
@@ -37,6 +37,8 @@
3737
*/
3838
public abstract class DynamicLauncher {
3939

40+
private static final int MAX_RETRY_ATTEMPTS = 10;
41+
4042
final String jdpName = UUID.randomUUID().toString();
4143
OutputAnalyzer output;
4244
int jmxPort;
@@ -52,7 +54,7 @@ protected void run() throws Exception {
5254
try {
5355
output.shouldNotContain("Port already in use");
5456
} catch (RuntimeException e) {
55-
if (retries < 3) {
57+
if (retries < MAX_RETRY_ATTEMPTS) {
5658
retries++;
5759
tryAgain = true;
5860
}

test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class JMXInterfaceBindingTest {
5252
public static final int JMX_PORT_RANGE_UPPER = 9200;
5353
public static final int JMX_PORT_RANGE_LOWER_SSL = 9201; // 9200 might be RMI Port
5454
public static final int JMX_PORT_RANGE_UPPER_SSL = 9300;
55-
private static final int MAX_RETRY_ATTEMTS = 10;
55+
private static final int MAX_RETRY_ATTEMPTS = 10;
5656
public static final String READY_MSG = "MainThread: Ready for connections";
5757
public static final String TEST_CLASS = JMXAgentInterfaceBinding.class.getSimpleName();
5858
public static final String KEYSTORE_LOC = System.getProperty("test.src", ".") +
@@ -159,7 +159,7 @@ public void run() {
159159
System.err.println("Retrying the test for " + name);
160160
}
161161
needRetry = runTest();
162-
} while (needRetry && (attempts++ < MAX_RETRY_ATTEMTS));
162+
} while (needRetry && (attempts++ < MAX_RETRY_ATTEMPTS));
163163

164164
if (testFailed) {
165165
int exitValue = output.getExitValue();

0 commit comments

Comments
 (0)