lhotari commented on a change in pull request #9850:
URL: https://github.com/apache/pulsar/pull/9850#discussion_r592207889



##########
File path: 
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/authorization/PulsarAuthorizationProvider.java
##########
@@ -293,8 +294,10 @@ public void initialize(ServiceConfiguration conf, 
ConfigurationCacheService conf
 
         final String policiesPath = String.format("/%s/%s/%s", "admin", 
POLICIES, namespaceName.toString());
         try {
-            pulsarResources.getNamespaceResources().set(policiesPath, 
(policies)->{
-                policies.auth_policies.namespace_auth.put(role, actions);
+            pulsarResources.getNamespaceResources().set(policiesPath, 
(policies) -> {
+                Set<AuthAction> authActionSet = Collections.newSetFromMap(new 
ConcurrentHashMap<>());
+                authActionSet.addAll(actions);
+                policies.auth_policies.namespace_auth.put(role, authActionSet);

Review comment:
       use `Map.compute` for the mutation (rational in the previous comment)




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to