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

[34/53] [abbrv] ambari git commit: AMBARI-20906 : made view directory watcher service optional by introducing views.directory.watcher.disable property in ambari.properties (nitirajrathore)

AMBARI-20906 : made view directory watcher service optional by introducing views.directory.watcher.disable property in ambari.properties (nitirajrathore)


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

Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 26d28efabecf225c255d6850b266ba2b22a5c6a3
Parents: aef6026
Author: Nitiraj Singh Rathore <ni...@gmail.com>
Authored: Tue May 2 14:24:55 2017 +0530
Committer: Nitiraj Singh Rathore <ni...@gmail.com>
Committed: Tue May 2 14:24:55 2017 +0530

----------------------------------------------------------------------
 .../ambari/server/configuration/Configuration.java  | 16 ++++++++++++++++
 .../ambari/server/controller/AmbariServer.java      |  6 +++++-
 .../org/apache/ambari/server/view/ViewRegistry.java |  2 +-
 3 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/26d28efa/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 55a4f50..ff20834 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -364,6 +364,13 @@ public class Configuration {
       "views.validate", "false");
 
   /**
+   * Determines whether the view directory watcher service should be disabled.
+   */
+  @Markdown(description = "Determines whether the view directory watcher service should be disabled.")
+  public static final ConfigurationProperty<String> DISABLE_VIEW_DIRECTORY_WATCHER = new ConfigurationProperty<>(
+      "views.directory.watcher.disable", "false");
+
+  /**
    * Determines whether remove undeployed views from the Ambari database.
    */
   @Markdown(description = "Determines whether remove undeployed views from the Ambari database.")
@@ -3296,6 +3303,15 @@ public class Configuration {
   }
 
   /**
+   * Determines whether the view directory watcher service should be disabled
+   *
+   * @return true view directory watcher service should be disabled
+   */
+  public boolean isViewDirectoryWatcherServiceDisabled() {
+    return Boolean.parseBoolean(getProperty(DISABLE_VIEW_DIRECTORY_WATCHER));
+  }
+
+  /**
    * @return conventional Java version number, e.g. 7.
    * Integer is used here to simplify comparisons during usage.
    * If java version is not supported, returns -1

http://git-wip-us.apache.org/repos/asf/ambari/blob/26d28efa/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index f80d2dc..bc6b428 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -455,7 +455,6 @@ public class AmbariServer {
       SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
 
       viewRegistry.readViewArchives();
-      viewDirectoryWatcher.start();
 
       //Check and load requestlog handler.
       loadRequestlogHandler(handlerList, serverForAgent, configsMap);
@@ -563,6 +562,11 @@ public class AmbariServer {
       serverForAgent.start();
       LOG.info("********* Started Server **********");
 
+      if( !configs.isViewDirectoryWatcherServiceDisabled()) {
+        LOG.info("Starting View Directory Watcher");
+        viewDirectoryWatcher.start();
+      }
+
       manager.start();
       LOG.info("********* Started ActionManager **********");
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/26d28efa/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index c7b2f79..6d16327 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -1811,7 +1811,7 @@ public class ViewRegistry {
   }
 
   // read a view archive
-  private void readViewArchive(ViewEntity viewDefinition,
+  private synchronized void readViewArchive(ViewEntity viewDefinition,
                                File archiveFile,
                                File extractedArchiveDirFile,
                                String serverVersion) {