You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by mp...@apache.org on 2017/04/27 17:47:58 UTC

ambari git commit: AMBARI-20876. Host precheck running too long. Intermittent. (mpapirkovskyy)

Repository: ambari
Updated Branches:
  refs/heads/trunk 59f9ab216 -> 8ed8f41a0


AMBARI-20876. Host precheck running too long. Intermittent. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ed8f41a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ed8f41a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ed8f41a

Branch: refs/heads/trunk
Commit: 8ed8f41a04e203a2ced17b024ae74da61f173b39
Parents: 59f9ab2
Author: Myroslav Papirkovskyi <mp...@hortonworks.com>
Authored: Thu Apr 27 20:31:51 2017 +0300
Committer: Myroslav Papirkovskyi <mp...@hortonworks.com>
Committed: Thu Apr 27 20:46:36 2017 +0300

----------------------------------------------------------------------
 .../java/org/apache/ambari/server/bootstrap/BSRunner.java   | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ed8f41a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
index cfd55bb..733a07a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/bootstrap/BSRunner.java
@@ -188,8 +188,7 @@ class BSRunner extends Thread {
     // Startup a scheduled executor service to look through the logs
     ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
     BSStatusCollector statusCollector = new BSStatusCollector();
-    ScheduledFuture<?> handle = scheduler.scheduleWithFixedDelay(statusCollector,
-        0, 10, TimeUnit.SECONDS);
+    ScheduledFuture<?> handle = null;
     LOG.info("Kicking off the scheduler for polling on logs in " +
     this.requestIdDir);
     String user = sshHostInfo.getUser();
@@ -208,6 +207,8 @@ class BSRunner extends Thread {
     String scriptlog = "";
     try {
       createRunDir();
+      handle = scheduler.scheduleWithFixedDelay(statusCollector,
+        0, 10, TimeUnit.SECONDS);
       if (LOG.isDebugEnabled()) {
         // FIXME needs to be removed later
         // security hole
@@ -357,7 +358,9 @@ class BSRunner extends Thread {
       } catch (InterruptedException e) {
         throw new IOException(e);
       } finally {
-        handle.cancel(true);
+        if (handle != null) {
+          handle.cancel(true);
+        }
         /* schedule a last update */
         scheduler.schedule(new BSStatusCollector(), 0, TimeUnit.SECONDS);
         scheduler.shutdownNow();