HADOOP-6760. WebServer shouldn't increase port number in case of

negative port setting caused by Jetty's race. Contributed by Konstantin
Boudnik.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@947218 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Konstantin Boudnik 2010-05-22 00:27:05 +00:00
parent ec1a112a1d
commit 4e5bdc46bc
2 changed files with 3 additions and 26 deletions

View File

@ -934,6 +934,9 @@ Release 0.21.0 - Unreleased
BUG FIXES
HADOOP-6760. WebServer shouldn't increase port number in case of negative
port setting caused by Jetty's race (cos)
HADOOP-5379. CBZip2InputStream to throw IOException on data crc error.
(Rodrigo Schmidt via zshao)

View File

@ -495,32 +495,6 @@ public void start() throws IOException {
} //Workaround end
LOG.info("Jetty bound to port " + port);
webServer.start();
// Workaround for HADOOP-6386
port = listener.getLocalPort();
if (port < 0) {
LOG.warn("Bounds port is " + port + " after webserver start");
for (int i = 0; i < MAX_RETRIES/2; i++) {
try {
webServer.stop();
} catch (Exception e) {
LOG.warn("Can't stop web-server", e);
}
Thread.sleep(1000);
listener.setPort(oriPort == 0 ? 0 : (oriPort += 1));
listener.open();
Thread.sleep(100);
webServer.start();
LOG.info(i + "attempts to restart webserver");
port = listener.getLocalPort();
if (port > 0)
break;
}
if (port < 0)
throw new Exception("listener.getLocalPort() is returning " +
"less than 0 even after " +MAX_RETRIES+" resets");
}
// End of HADOOP-6386 workaround
break;
} catch (IOException ex) {
// if this is a bind exception,