You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2016/04/28 06:11:33 UTC

incubator-ranger git commit: RANGER-891: Audit shutdown hook to be registered with Hadoop ShutdownHookManager instead of directly with Java Runtime

Repository: incubator-ranger
Updated Branches:
  refs/heads/master 2bd8581f9 -> 41a3d67aa


RANGER-891: Audit shutdown hook to be registered with Hadoop ShutdownHookManager instead of directly with Java Runtime


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

Branch: refs/heads/master
Commit: 41a3d67aa2d5cd76f627a8e2c09e36fe5bf28d49
Parents: 2bd8581
Author: Alok Lal <al...@apache.org>
Authored: Wed Apr 27 21:07:41 2016 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Wed Apr 27 21:07:41 2016 -0700

----------------------------------------------------------------------
 .../org/apache/ranger/audit/provider/AuditProviderFactory.java  | 5 ++++-
 src/main/assembly/plugin-solr.xml                               | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/41a3d67a/agents-audit/src/main/java/org/apache/ranger/audit/provider/AuditProviderFactory.java
----------------------------------------------------------------------
diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/provider/AuditProviderFactory.java b/agents-audit/src/main/java/org/apache/ranger/audit/provider/AuditProviderFactory.java
index cb998cd..b95e2a9 100644
--- a/agents-audit/src/main/java/org/apache/ranger/audit/provider/AuditProviderFactory.java
+++ b/agents-audit/src/main/java/org/apache/ranger/audit/provider/AuditProviderFactory.java
@@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.util.ShutdownHookManager;
 import org.apache.ranger.audit.destination.DBAuditDestination;
 import org.apache.ranger.audit.destination.FileAuditDestination;
 import org.apache.ranger.audit.destination.HDFSAuditDestination;
@@ -64,6 +65,8 @@ public class AuditProviderFactory {
 	public static final int AUDIT_ASYNC_MAX_QUEUE_SIZE_DEFAULT = 10 * 1024;
 	public static final int AUDIT_ASYNC_MAX_FLUSH_INTERVAL_DEFAULT = 5 * 1000;
 
+	private static final int RANGER_AUDIT_SHUTDOWN_HOOK_PRIORITY = 30;
+
 	private static AuditProviderFactory sFactory;
 
 	private AuditHandler mProvider = null;
@@ -448,7 +451,7 @@ public class AuditProviderFactory {
 	private void installJvmSutdownHook(Properties props) {
 		int shutdownHookMaxWaitSeconds = MiscUtil.getIntProperty(props, AUDIT_SHUTDOWN_HOOK_MAX_WAIT_SEC, AUDIT_SHUTDOWN_HOOK_MAX_WAIT_SEC_DEFAULT);
 		JVMShutdownHook jvmShutdownHook = new JVMShutdownHook(mProvider, shutdownHookMaxWaitSeconds);
-		Runtime.getRuntime().addShutdownHook(jvmShutdownHook);
+		ShutdownHookManager.get().addShutdownHook(jvmShutdownHook, RANGER_AUDIT_SHUTDOWN_HOOK_PRIORITY);
 	}
 
 	private static class RangerAsyncAuditCleanup implements Runnable {

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/41a3d67a/src/main/assembly/plugin-solr.xml
----------------------------------------------------------------------
diff --git a/src/main/assembly/plugin-solr.xml b/src/main/assembly/plugin-solr.xml
index 1ee926d..c96e63f 100644
--- a/src/main/assembly/plugin-solr.xml
+++ b/src/main/assembly/plugin-solr.xml
@@ -43,6 +43,7 @@
 						<outputDirectory>/lib/ranger-solr-plugin-impl</outputDirectory>
 						<unpack>false</unpack>
 						<includes>
+							<include>org.apache.hadoop:hadoop-common:jar:${hadoop-common.version}</include>
 							<include>com.google.code.gson:gson</include>
 							<include>org.eclipse.persistence:eclipselink</include>
 							<include>org.eclipse.persistence:javax.persistence</include>