Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class RangerCacheDorisAccessController extends CatalogCacheAccessControll

public RangerCacheDorisAccessController(String serviceName) {
this.cache = new RangerCache();
this.proxyController = new RangerDorisAccessController(serviceName, new RangerCacheInvalidateListener(cache));
this.proxyController = RangerDorisAccessController.getInstance(serviceName,
new RangerCacheInvalidateListener(cache));
this.cache.init(proxyController);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,36 @@
public class RangerDorisAccessController extends RangerAccessController {
private static final Logger LOG = LogManager.getLogger(RangerDorisAccessController.class);
private RangerBasePlugin dorisPlugin;

private static RangerDorisAccessController instance;

// private static ScheduledThreadPoolExecutor logFlushTimer = ThreadPoolManager.newDaemonScheduledThreadPool(1,
// "ranger-doris-audit-log-flusher-timer", true);
// private RangerHiveAuditHandler auditHandler;

public RangerDorisAccessController(String serviceName) {
private RangerDorisAccessController(String serviceName) {
this(serviceName, null);
}

public RangerDorisAccessController(String serviceName, RangerAuthContextListener rangerAuthContextListener) {
private RangerDorisAccessController(String serviceName, RangerAuthContextListener rangerAuthContextListener) {
dorisPlugin = new RangerDorisPlugin(serviceName, rangerAuthContextListener);
// auditHandler = new RangerHiveAuditHandler(dorisPlugin.getConfig());
// start a timed log flusher
// logFlushTimer.scheduleAtFixedRate(new RangerHiveAuditLogFlusher(auditHandler), 10, 20L, TimeUnit.SECONDS);
}

public static RangerDorisAccessController getInstance(String serviceName) {
return getInstance(serviceName, null);
}

public static synchronized RangerDorisAccessController getInstance(String serviceName,
RangerAuthContextListener rangerAuthContextListener) {
if (instance == null) {
instance = new RangerDorisAccessController(serviceName, rangerAuthContextListener);
}
return instance;
}

@VisibleForTesting
public RangerDorisAccessController(RangerBasePlugin plugin) {
dorisPlugin = plugin;
Expand Down
Loading