mirror of
https://github.com/openjdk/jdk.git
synced 2026-08-03 06:35:31 +00:00
8145392: Build fails with "No portfile values materialized"
Increased default server startup timeout. Reviewed-by: jlahoda
This commit is contained in:
parent
5cd3c7cac8
commit
7d17c7744d
@ -225,10 +225,10 @@ public class PortFile {
|
||||
* Wait for the port file to contain values that look valid.
|
||||
*/
|
||||
public void waitForValidValues() throws IOException, InterruptedException {
|
||||
final int MAX_ATTEMPTS = 10;
|
||||
final int MS_BETWEEN_ATTEMPTS = 500;
|
||||
long startTime = System.currentTimeMillis();
|
||||
for (int attempt = 0; ; attempt++) {
|
||||
long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
|
||||
while (true) {
|
||||
Log.debug("Looking for valid port file values...");
|
||||
lock();
|
||||
getValues();
|
||||
@ -237,12 +237,13 @@ public class PortFile {
|
||||
Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
|
||||
return;
|
||||
}
|
||||
if (attempt >= MAX_ATTEMPTS) {
|
||||
throw new IOException("No port file values materialized. Giving up after " +
|
||||
(System.currentTimeMillis() - startTime) + " ms");
|
||||
if (System.currentTimeMillis() > timeout) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(MS_BETWEEN_ATTEMPTS);
|
||||
}
|
||||
throw new IOException("No port file values materialized. Giving up after " +
|
||||
(System.currentTimeMillis() - startTime) + " ms");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -282,4 +283,15 @@ public class PortFile {
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
private long getServerStartupTimeoutSeconds() {
|
||||
String str = System.getProperty("serverStartupTimeout");
|
||||
if (str != null) {
|
||||
try {
|
||||
return Integer.parseInt(str);
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user