mneethiraj commented on code in PR #595:
URL: https://github.com/apache/ranger/pull/595#discussion_r2323340109
##########
agents-common/src/main/java/org/apache/ranger/plugin/service/RangerBasePlugin.java:
##########
@@ -1490,7 +1490,7 @@ private static final class LogHistory {
private boolean isSynchronousPolicyRefresh() {
boolean ret = false;
if (this.getServiceConfigs() != null && this.pluginConfig != null &&
this.pluginConfig.getServiceType() != null) {
- String synchronousPolicyRefreshConfigName =
"ranger.plugins.conf.policy.refresh.synchronous";
+ String synchronousPolicyRefreshConfigName =
String.format("ranger.plugin.%s.policy.refresh.synchronous",
this.pluginConfig.getServiceType());
if
(this.getServiceConfigs().containsKey(synchronousPolicyRefreshConfigName)) {
boolean synchronousPolicyRefreshConfigValue =
Boolean.parseBoolean(this.getServiceConfigs().get(synchronousPolicyRefreshConfigName).trim().toLowerCase());
if (synchronousPolicyRefreshConfigValue) {
Review Comment:
I suggest replacing lines 1492 - 1496 with the following:
```
Map<String, String> serviceConfigs = this.serviceConfigs;
String isSyncPolicyRefresh = serviceConfigs == null ? null :
serviceConfigs.get(pluginConfig.getPropertyPrefix() +
".policy.refresh.synchronous");
if (Boolean.parseBoolean(isSyncPolicyRefresh)) {
```
A better option would be to introduce `boolean` member
`RangerBasePlugin.isSynchronousPolicyRefresh`, and update its value in
`RangerBasePlugin.setServiceConfig()`. This will avoid parsing the value on
every authorization call.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]