From 74e43bf287b9c2bfaa531e510635a8238a696da9 Mon Sep 17 00:00:00 2001 From: Varun Saxena Date: Sat, 11 Feb 2017 19:21:45 +0530 Subject: [PATCH] YARN-6170. TimelineReaderServer should wait to join with HttpServer2 (Sangjin Lee via Varun Saxena) (cherry picked from commit 649deb72fbb62568b4ea0d67444df6faaaed169d) --- .../reader/TimelineReaderServer.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java index 116cc2ab19c..8c5e72df765 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/reader/TimelineReaderServer.java @@ -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) { @@ -185,6 +195,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(); } } \ No newline at end of file