You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by rm...@apache.org on 2014/09/19 23:32:53 UTC

[2/9] git commit: ARGUS-42

ARGUS-42

Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/3272c005
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/3272c005
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/3272c005

Branch: refs/heads/master
Commit: 3272c005b3af021974e9f85cbc3e3e409d60c532
Parents: 2b0ee42
Author: rmani <rm...@hortonworks.com>
Authored: Thu Sep 11 16:44:58 2014 -0700
Committer: rmani <rm...@hortonworks.com>
Committed: Thu Sep 11 16:44:58 2014 -0700

----------------------------------------------------------------------
 .../java/com/xasecure/pdp/config/ConfigWatcher.java  | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/3272c005/agents-impl/src/main/java/com/xasecure/pdp/config/ConfigWatcher.java
----------------------------------------------------------------------
diff --git a/agents-impl/src/main/java/com/xasecure/pdp/config/ConfigWatcher.java b/agents-impl/src/main/java/com/xasecure/pdp/config/ConfigWatcher.java
index 449db16..e286cfb 100644
--- a/agents-impl/src/main/java/com/xasecure/pdp/config/ConfigWatcher.java
+++ b/agents-impl/src/main/java/com/xasecure/pdp/config/ConfigWatcher.java
@@ -260,7 +260,7 @@ public abstract class ConfigWatcher extends Thread {
              
 				if (response != null) {
 					
-					Boolean responsePresent = true;
+					boolean responsePresent = true;
 					int	responseStatus = response.getStatus();
 					
 					if ( fetchPolicyfromCahce(responsePresent,responseStatus,lastStoredFileName) ) {
@@ -277,6 +277,7 @@ public abstract class ConfigWatcher extends Thread {
 									policyContainer = newPolicyContainer;
 									lastModifiedTime = policyContainer.getLastUpdatedTimeInEpoc();
 									isChanged = true;
+									policyCacheLoadedOnce = false;
 									if (LOG.isDebugEnabled()) {
 										LOG.debug("Got response: 200 with {change in lastupdatedTime}\n" + gson.toJson(newPolicyContainer));
 									}
@@ -313,12 +314,14 @@ public abstract class ConfigWatcher extends Thread {
 			}
 		} catch (Throwable t) {
 			
-			Boolean responsePresent = false;
+			boolean responsePresent = false;
 			int	responseStatus = -1;
-			
+			if (LOG.isDebugEnabled()) {
+				LOG.debug("Policy Manager Failed",t);
+			}
 			if ( fetchPolicyfromCahce(responsePresent,responseStatus,lastStoredFileName) ) {
 	 	    /* Successfully found the Policy Cache file and loaded */
-		  	     isChanged = true;
+		  	     isChanged = false;
 		     } else {
 		    	 LOG.error("Unable to complete isFileChanged()  call for [" + url + "]", t);
 				 // force the policy update to get fresh copy
@@ -478,7 +481,7 @@ public abstract class ConfigWatcher extends Thread {
 		return agentName  ;
 	}
 	
-	private boolean fetchPolicyfromCahce( Boolean responsePresent, int responseStatus, String lastStoredFileName){
+	private boolean fetchPolicyfromCahce( boolean responsePresent, int responseStatus, String lastStoredFileName){
 	
 		boolean cacheFound = false;
 		
@@ -509,7 +512,7 @@ public abstract class ConfigWatcher extends Thread {
 					policyCacheLoadedOnce = true;
 	        	
 	    	 	} catch( FileNotFoundException fe ){
-	    		
+	    	 		
 		    		/* unable to get the last stored policy, raise warning for unavailability of policy cache file and continue...*/
 		    		if ( this.lastStoredFileName == null ) {
 		    			LOG.info("Policy cache file not found...XAagent authorization not enabled");