8145392: Build fails with "No portfile values materialized"
Summary: Increased default server startup timeout.
Reviewed-by: jlahoda
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java Sun Jan 24 11:32:38 2016 +0100
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/PortFile.java Sun Jan 24 11:44:10 2016 +0100
@@ -225,10 +225,10 @@
* 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 @@
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 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;
+ }
}