This is an automated email from the ASF dual-hosted git repository.
abhay 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 4f297c35b RANGER-4938: Ensure that only one instance of Ranger plugin
is created in an Ozone Manager process
4f297c35b is described below
commit 4f297c35bab531877890a3e0a1c460a2eb3becd2
Author: Abhay Kulkarni <[email protected]>
AuthorDate: Tue Sep 24 10:21:22 2024 -0700
RANGER-4938: Ensure that only one instance of Ranger plugin is created in
an Ozone Manager process
---
.../ozone/authorizer/RangerOzoneAuthorizer.java | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git
a/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
b/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
index f67e182bd..3bd17d52f 100644
---
a/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
+++
b/plugin-ozone/src/main/java/org/apache/ranger/authorization/ozone/authorizer/RangerOzoneAuthorizer.java
@@ -60,11 +60,23 @@ public class RangerOzoneAuthorizer implements
IAccessAuthorizer {
RangerDefaultAuditHandler auditHandler = null;
public RangerOzoneAuthorizer() {
- rangerPlugin = new RangerBasePlugin("ozone", "ozone");
+ RangerBasePlugin plugin = rangerPlugin;
- rangerPlugin.init(); // this will initialize policy engine and
policy refresher
- auditHandler = new RangerDefaultAuditHandler();
- rangerPlugin.setResultProcessor(auditHandler);
+ if (plugin == null) {
+ synchronized (RangerOzoneAuthorizer.class) {
+ plugin = rangerPlugin;
+
+ if (plugin == null) {
+ plugin = new RangerBasePlugin("ozone",
"ozone");
+ plugin.init(); // this will initialize
policy engine and policy refresher
+
+ auditHandler = new
RangerDefaultAuditHandler();
+ plugin.setResultProcessor(auditHandler);
+
+ rangerPlugin = plugin;
+ }
+ }
+ }
}
@Override