You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by bo...@apache.org on 2015/05/26 22:56:59 UTC

[2/3] incubator-ranger git commit: RANGER-246 Incorporated review feedback

RANGER-246 Incorporated review feedback

Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/0d847939
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/0d847939
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/0d847939

Branch: refs/heads/master
Commit: 0d8479394c4912d18ccad61979cd4e9bb8cc6713
Parents: 48a2cd1
Author: Don Bosco Durai <bo...@apache.org>
Authored: Tue May 26 12:40:01 2015 -0700
Committer: Don Bosco Durai <bo...@apache.org>
Committed: Tue May 26 12:40:01 2015 -0700

----------------------------------------------------------------------
 .../ranger/plugin/service/RangerBasePlugin.java   | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/0d847939/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
index 8131ab6..7af103d 100644
--- a/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
+++ b/agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java
@@ -308,20 +308,28 @@ public class RangerBasePlugin {
 		LogHistory log = logHistoryList.get(message);
 		if (log == null) {
 			log = new LogHistory();
-			log.message = message;
-			log.lastLogTime = 0;
+			logHistoryList.put(message, log);
 		}
+		log.lifetimeCounter++;
 		if ((System.currentTimeMillis() - log.lastLogTime) > logInterval) {
 			log.lastLogTime = System.currentTimeMillis();
+			int counter = log.counter;
+			log.counter = 0;
+			if( counter > 0) {
+				message += ". Messages suppressed before: " + counter;
+			}
 			LOG.error(message);
 			return true;
+		} else {
+			log.counter++;
 		}
 		return false;
 	}
 
-	class LogHistory {
-		long lastLogTime;
-		String message;
+	static class LogHistory {
+		long lastLogTime = 0;
+		int counter=0;
+		int lifetimeCounter = 0;
 	}
 
 }