You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/01/03 09:54:07 UTC

[GitHub] zongtanghu commented on a change in pull request #651: [ISSUE#403] fix acl config file watch bug, clean and optimize the codes for acl feature.

zongtanghu commented on a change in pull request #651: [ISSUE#403] fix acl config file watch bug,clean and optimize the codes for acl feature.
URL: https://github.com/apache/rocketmq/pull/651#discussion_r244950107
 
 

 ##########
 File path: acl/src/main/java/org/apache/rocketmq/acl/plain/PlainPermissionLoader.java
 ##########
 @@ -77,92 +75,52 @@ public void initialize() {
         JSONArray globalWhiteRemoteAddressesList = plainAclConfData.getJSONArray("globalWhiteRemoteAddresses");
         if (globalWhiteRemoteAddressesList != null && !globalWhiteRemoteAddressesList.isEmpty()) {
             for (int i = 0; i < globalWhiteRemoteAddressesList.size(); i++) {
-                addGlobalWhiteRemoteAddress(globalWhiteRemoteAddressesList.getString(i));
+                globalWhiteRemoteAddressStrategy.add(remoteAddressStrategyFactory.
+                        getRemoteAddressStrategy(globalWhiteRemoteAddressesList.getString(i)));
             }
         }
 
         JSONArray accounts = plainAclConfData.getJSONArray("accounts");
         if (accounts != null && !accounts.isEmpty()) {
-            List<PlainAccessConfig> plainAccessList = accounts.toJavaList(PlainAccessConfig.class);
-            for (PlainAccessConfig plainAccess : plainAccessList) {
-                this.addPlainAccessResource(getPlainAccessResource(plainAccess));
+            List<PlainAccessConfig> plainAccessConfigList = accounts.toJavaList(PlainAccessConfig.class);
+            for (PlainAccessConfig plainAccessConfig : plainAccessConfigList) {
+                PlainAccessResource plainAccessResource = buildPlainAccessResource(plainAccessConfig);
+                plainAccessResourceMap.put(plainAccessResource.getAccessKey(),plainAccessResource);
             }
         }
-    }
 
-    private void watch() {
-        String version = System.getProperty("java.version");
-        String[] str = StringUtils.split(version, ".");
-        if (Integer.valueOf(str[1]) < 7) {
-            log.warn("Watch need jdk equal or greater than 1.7, current version is {}", str[1]);
-            return;
+        this.lock.writeLock().lock();
+        try {
 
 Review comment:
   Okay,thank,we will fix this code.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services