Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,15 @@ private void startProcess(String location, PortPair [] ports) {
}

private void checkProcessIsAlive() throws IOException {
Thread.yield();
if(!process.isAlive() && process.exitValue() != 0) {
throw new OpenShiftException("Port forwarding process exited: %s", IOUtils.toString(process.getErrorStream()));
try {
Thread.sleep(1000);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcantrill I seriously doubt that a fixed timeout is the right thing to do. What if trying to launch the process takes longer than the hard coded 1 sec?
IMHO you should have a shared lock which makes sure that testing for the process to be alive only occurrs once the process is launched.

if(!process.isAlive() && process.exitValue() != 0) {
throw new OpenShiftException("Port forwarding process exited: %s", IOUtils.toString(process.getErrorStream()));
}
} catch (InterruptedException e) {
if(!process.isAlive() && process.exitValue() != 0) {
throw new OpenShiftException("Port forwarding process exited: %s", IOUtils.toString(process.getErrorStream()));
}
}
}

Expand Down