This is an automated email from the ASF dual-hosted git repository. madhan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ranger.git
The following commit(s) were added to refs/heads/master by this push: new b581a4b RANGER-2654: avoid multiple initializations of audit-factory (RangerBasePlugin refactoring - #3) b581a4b is described below commit b581a4b478d6263eea6176fb5c7a51b875821681 Author: Madhan Neethiraj <mad...@apache.org> AuthorDate: Tue Dec 3 23:10:51 2019 -0800 RANGER-2654: avoid multiple initializations of audit-factory (RangerBasePlugin refactoring - #3) --- .../org/apache/ranger/plugin/service/RangerBasePlugin.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 70670c3..00a23e3 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 @@ -143,11 +143,15 @@ public class RangerBasePlugin { public void init() { cleanup(); - if (pluginConfig.getProperties() != null) { - AuditProviderFactory.getInstance().init(pluginConfig.getProperties(), getAppId()); - } else { - LOG.error("Audit subsystem is not initialized correctly. Please check audit configuration. "); - LOG.error("No authorization audits will be generated. "); + AuditProviderFactory providerFactory = AuditProviderFactory.getInstance(); + + if (!providerFactory.isInitDone()) { + if (pluginConfig.getProperties() != null) { + providerFactory.init(pluginConfig.getProperties(), getAppId()); + } else { + LOG.error("Audit subsystem is not initialized correctly. Please check audit configuration. "); + LOG.error("No authorization audits will be generated. "); + } } refresher = new PolicyRefresher(this);