8150941: Sjavac should not wait for portfile to materialize if server process is terminated
Sjavac cancels forking early if server process dies. Reviewed-by: jlahoda
This commit is contained in:
parent
b1bd20bdd0
commit
b1bb5651a3
@ -257,7 +257,7 @@ public class SjavacClient implements Sjavac {
|
||||
// serverProcess != null at this point.
|
||||
try {
|
||||
// Throws an IOException if no valid values materialize
|
||||
portFile.waitForValidValues();
|
||||
portFile.waitForValidValues(serverProcess);
|
||||
} catch (IOException ex) {
|
||||
// Process was started, but server failed to initialize. This could
|
||||
// for instance be due to the JVM not finding the server class,
|
||||
|
@ -232,7 +232,7 @@ public class PortFile {
|
||||
/**
|
||||
* Wait for the port file to contain values that look valid.
|
||||
*/
|
||||
public void waitForValidValues() throws IOException, InterruptedException {
|
||||
public void waitForValidValues(Process serverProcess) throws IOException, InterruptedException {
|
||||
final int MS_BETWEEN_ATTEMPTS = 500;
|
||||
long startTime = System.currentTimeMillis();
|
||||
long timeout = startTime + getServerStartupTimeoutSeconds() * 1000;
|
||||
@ -250,6 +250,9 @@ public class PortFile {
|
||||
if (System.currentTimeMillis() > timeout) {
|
||||
break;
|
||||
}
|
||||
if (!serverProcess.isAlive()) {
|
||||
throw new IOException("Server process terminated.");
|
||||
}
|
||||
Thread.sleep(MS_BETWEEN_ATTEMPTS);
|
||||
}
|
||||
throw new IOException("No port file values materialized. Giving up after " +
|
||||
|
Loading…
Reference in New Issue
Block a user