ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject git commit: ARGUS-154: update per review comments
Date Thu, 06 Nov 2014 01:38:23 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/ranger-0.4 cecfd51c3 -> 8dba6a3c6


ARGUS-154: update per review comments


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

Branch: refs/heads/ranger-0.4
Commit: 8dba6a3c65ccf28a6fdbc034b2029ba1e9062b36
Parents: cecfd51
Author: Madhan Neethiraj <madhan@apache.org>
Authored: Wed Nov 5 17:28:41 2014 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Wed Nov 5 17:35:05 2014 -0800

----------------------------------------------------------------------
 .../audit/provider/LocalFileLogBuffer.java      | 62 ++++++++++----------
 1 file changed, 32 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/8dba6a3c/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
b/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
index 69df673..b60b791 100644
--- a/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
+++ b/agents-audit/src/main/java/com/xasecure/audit/provider/LocalFileLogBuffer.java
@@ -218,43 +218,45 @@ public class LocalFileLogBuffer<T> implements LogBuffer<T>
{
 
 	private synchronized void openFile() {
 		mLogger.debug("==> LocalFileLogBuffer.openFile()");
-		
+
 		long now = System.currentTimeMillis();
 
 		closeFile();
 
 		if(mNextFileOpenRetryTime <= now) {
-			mNextRolloverTime = MiscUtil.getNextRolloverTime(mNextRolloverTime, (mRolloverIntervalSeconds
* 1000L));
-	
-			long startTime = MiscUtil.getRolloverStartTime(mNextRolloverTime, (mRolloverIntervalSeconds
* 1000L));
-	
-			mBufferFilename = MiscUtil.replaceTokens(mDirectory + File.separator + mFile, startTime);
-	
-			MiscUtil.createParents(new File(mBufferFilename));
-	
-			FileOutputStream ostream = null;
 			try {
-				ostream = new FileOutputStream(mBufferFilename, mIsAppend);
-			} catch(Exception excp) {
-				mLogger.warn("LocalFileLogBuffer.openFile(): failed to open file " + mBufferFilename,
excp);
-			}
-	
-			if(ostream != null) {
-				mWriter = createWriter(ostream);
-	
-				if(mWriter != null) {
-					mLogger.debug("LocalFileLogBuffer.openFile(): opened file " + mBufferFilename);
-		
-					mNextFlushTime = System.currentTimeMillis() + (mFlushIntervalSeconds * 1000L);
-				} else {
-					mLogger.warn("LocalFileLogBuffer.openFile(): failed to open file for write " + mBufferFilename);
-		
-					mBufferFilename = null;
+				mNextRolloverTime = MiscUtil.getNextRolloverTime(mNextRolloverTime, (mRolloverIntervalSeconds
* 1000L));
+
+				long startTime = MiscUtil.getRolloverStartTime(mNextRolloverTime, (mRolloverIntervalSeconds
* 1000L));
+
+				mBufferFilename = MiscUtil.replaceTokens(mDirectory + File.separator + mFile, startTime);
+
+				MiscUtil.createParents(new File(mBufferFilename));
+
+				FileOutputStream ostream = null;
+				try {
+					ostream = new FileOutputStream(mBufferFilename, mIsAppend);
+				} catch(Exception excp) {
+					mLogger.warn("LocalFileLogBuffer.openFile(): failed to open file " + mBufferFilename,
excp);
+				}
+
+				if(ostream != null) {
+					mWriter = createWriter(ostream);
+
+					if(mWriter != null) {
+						mLogger.debug("LocalFileLogBuffer.openFile(): opened file " + mBufferFilename);
+
+						mNextFlushTime = System.currentTimeMillis() + (mFlushIntervalSeconds * 1000L);
+					} else {
+						mLogger.warn("LocalFileLogBuffer.openFile(): failed to open file for write " + mBufferFilename);
+
+						mBufferFilename = null;
+					}
+				}
+			} finally {
+				if(mWriter == null) {
+					mNextFileOpenRetryTime = now + mFileOpenRetryIntervalInMs;
 				}
-			}
-			
-			if(mWriter == null) {
-				mNextFileOpenRetryTime = now + mFileOpenRetryIntervalInMs;
 			}
 		}
 


Mime
View raw message