YARN-6170. TimelineReaderServer should wait to join with HttpServer2 (Sangjin Lee via Varun Saxena)

This commit is contained in:
Varun Saxena 2017-02-11 19:21:45 +05:30
parent 0aacd8fd25
commit 649deb72fb
1 changed files with 12 additions and 1 deletions

View File

@ -110,6 +110,16 @@ public class TimelineReaderServer extends CompositeService {
startTimelineReaderWebApp();
}
private void join() {
// keep the main thread that started the server up until it receives a stop
// signal
if (readerWebServer != null) {
try {
readerWebServer.join();
} catch (InterruptedException ignore) {}
}
}
@Override
protected void serviceStop() throws Exception {
if (readerWebServer != null) {
@ -194,6 +204,7 @@ public class TimelineReaderServer extends CompositeService {
Configuration conf = new YarnConfiguration();
conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true);
conf.setFloat(YarnConfiguration.TIMELINE_SERVICE_VERSION, 2.0f);
startTimelineReaderServer(args, conf);
TimelineReaderServer server = startTimelineReaderServer(args, conf);
server.join();
}
}