8310525: DynamicLauncher for JDP test needs to try harder to find a free port

Reviewed-by: lmesnik, cjplummer
This commit is contained in:
Kevin Walls 2024-09-16 18:24:47 +00:00
parent 89759c8b02
commit 59407faf7b
2 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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
@ -37,6 +37,8 @@ import java.util.UUID;
*/
public abstract class DynamicLauncher {
private static final int MAX_RETRY_ATTEMPTS = 10;
final String jdpName = UUID.randomUUID().toString();
OutputAnalyzer output;
int jmxPort;
@ -52,7 +54,7 @@ public abstract class DynamicLauncher {
try {
output.shouldNotContain("Port already in use");
} catch (RuntimeException e) {
if (retries < 3) {
if (retries < MAX_RETRY_ATTEMPTS) {
retries++;
tryAgain = true;
}

View File

@ -52,7 +52,7 @@ public class JMXInterfaceBindingTest {
public static final int JMX_PORT_RANGE_UPPER = 9200;
public static final int JMX_PORT_RANGE_LOWER_SSL = 9201; // 9200 might be RMI Port
public static final int JMX_PORT_RANGE_UPPER_SSL = 9300;
private static final int MAX_RETRY_ATTEMTS = 10;
private static final int MAX_RETRY_ATTEMPTS = 10;
public static final String READY_MSG = "MainThread: Ready for connections";
public static final String TEST_CLASS = JMXAgentInterfaceBinding.class.getSimpleName();
public static final String KEYSTORE_LOC = System.getProperty("test.src", ".") +
@ -159,7 +159,7 @@ public class JMXInterfaceBindingTest {
System.err.println("Retrying the test for " + name);
}
needRetry = runTest();
} while (needRetry && (attempts++ < MAX_RETRY_ATTEMTS));
} while (needRetry && (attempts++ < MAX_RETRY_ATTEMPTS));
if (testFailed) {
int exitValue = output.getExitValue();