ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgerg...@apache.org
Subject ambari git commit: AMBARI-20515 APPENDUM Link Log Feeder not working with Kerberos (mgergely)
Date Wed, 22 Mar 2017 11:03:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk fa754d60c -> a8a1ee8b3


AMBARI-20515 APPENDUM Link Log Feeder not working with Kerberos (mgergely)

Change-Id: I5f2b363f7e14507e2521e5cdfd078f7c20f8e06a


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

Branch: refs/heads/trunk
Commit: a8a1ee8b36cd7e66a5c1bc56d743e77de2d423d3
Parents: fa754d6
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Wed Mar 22 12:03:30 2017 +0100
Committer: Miklos Gergely <mgergely@hortonworks.com>
Committed: Wed Mar 22 12:03:30 2017 +0100

----------------------------------------------------------------------
 .../logfeeder/logconfig/LogConfigHandler.java   | 30 ++++++++++++++++++--
 .../ambari/logfeeder/output/OutputSolr.java     | 23 ---------------
 2 files changed, 27 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a8a1ee8b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
index 4f52b0b..0ece637 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/logconfig/LogConfigHandler.java
@@ -40,7 +40,8 @@ public class LogConfigHandler extends Thread {
   private static final int DEFAULT_SOLR_CONFIG_INTERVAL = 5;
   private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS";
   private static final String TIMEZONE = "GMT";
-  
+  private static final int RETRY_INTERVAL = 30;
+
   static {
     TimeZone.setDefault(TimeZone.getTimeZone(TIMEZONE));
   }
@@ -53,13 +54,14 @@ public class LogConfigHandler extends Thread {
     }
   };
   
+  private static boolean filterEnabled;
   private static LogFeederFilterWrapper logFeederFilterWrapper;
 
   private static boolean running = false;
 
   public static void handleConfig() {
-    boolean filterEnable = LogFeederUtil.getBooleanProperty("logfeeder.log.filter.enable",
false);
-    if (!filterEnable) {
+    filterEnabled = LogFeederUtil.getBooleanProperty("logfeeder.log.filter.enable", false);
+    if (!filterEnabled) {
       LOG.info("Logfeeder filter Scheduler is disabled.");
       return;
     }
@@ -174,6 +176,8 @@ public class LogConfigHandler extends Thread {
   }
   
   public static LogFeederFilter findComponentFilter(String componentName) {
+    waitForFilter();
+    
     if (logFeederFilterWrapper != null) {
       HashMap<String, LogFeederFilter> filter = logFeederFilterWrapper.getFilter();
       if (filter != null) {
@@ -186,4 +190,24 @@ public class LogConfigHandler extends Thread {
     LOG.trace("Filter is not there for component :" + componentName);
     return null;
   }
+
+  private static void waitForFilter() {
+    if (!filterEnabled || logFeederFilterWrapper != null) {
+      return;
+    }
+    
+    while (true) {
+      try {
+        Thread.sleep(RETRY_INTERVAL * 1000);
+      } catch (InterruptedException e) {
+        LOG.error(e);
+      }
+      
+      LOG.info("Checking if config is available");
+      if (logFeederFilterWrapper != null) {
+        LOG.info("Config is available");
+        return;
+      }
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a8a1ee8b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
index 0030a6d..d37a3bb 100644
--- a/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
+++ b/ambari-logsearch/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
@@ -34,7 +34,6 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.ambari.logfeeder.input.InputMarker;
-import org.apache.ambari.logfeeder.logconfig.LogConfigHandler;
 import org.apache.ambari.logfeeder.util.DateUtil;
 import org.apache.ambari.logfeeder.util.LogFeederUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -326,8 +325,6 @@ public class OutputSolr extends Output {
       LOG.info("SolrWorker thread started");
       long lastDispatchTime = System.currentTimeMillis();
 
-      waitForConfig();
-      
       while (true) {
         long currTimeMS = System.currentTimeMillis();
         OutputData outputData = null;
@@ -371,26 +368,6 @@ public class OutputSolr extends Output {
       LOG.info("Exiting Solr worker thread. output=" + getShortDescription());
     }
     
-
-    private void waitForConfig() {
-      if (!LogFeederUtil.getBooleanProperty("logfeeder.log.filter.enable", false)) {
-        return;
-      }
-      
-      while (true) {
-        LOG.info("Checking if config is available");
-        if (LogConfigHandler.isFilterAvailable()) {
-          LOG.info("Config is available");
-          return;
-        }
-        try {
-          Thread.sleep(RETRY_INTERVAL * 1000);
-        } catch (InterruptedException e) {
-          LOG.error(e);
-        }
-      }
-    }
-
     /**
      * This will loop till Solr is available and LogFeeder is
      * successfully able to write to the collection or shard. It will block till


Mime
View raw message