Skip to content

Commit

Permalink
RANGER-4938: Ensure that only one instance of Ranger plugin is create…
Browse files Browse the repository at this point in the history
…d in an Ozone Manager process
  • Loading branch information
kulkabhay committed Sep 27, 2024
1 parent 7af5931 commit 4f297c3
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4f297c3

Please sign in to comment.