This is an automated email from the ASF dual-hosted git repository.

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new f247ca7  formate config-nacos model by intellij-java-google-style.xml 
(#1414)
f247ca7 is described below

commit f247ca70fe641bace9b983bb7ae3a099e8f16e16
Author: 160731liupf <[email protected]>
AuthorDate: Thu Nov 28 09:15:46 2019 +0800

    formate config-nacos model by intellij-java-google-style.xml (#1414)
    
    * add nacos model
    
    * add nacos model
    
    * nacos client
    
    * optimize nacos model
    
    * optimize nacos test
    
    * add NacosConfigurationSourceImpl properties
    
    * remove slf4j-jdk14 and add README.md file
    
    * update license and use different package
    
    * formate code by intellij-java-google-style.xml
    
    * delete double space in config-nacos model
---
 .../config/nacos/client/NacosClient.java           | 60 ++++++++++++----------
 1 file changed, 32 insertions(+), 28 deletions(-)

diff --git 
a/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/client/NacosClient.java
 
b/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/client/NacosClient.java
index 8a06771..dfa7eb6 100644
--- 
a/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/client/NacosClient.java
+++ 
b/dynamic-config/config-nacos/src/main/java/org/apache/servicecomb/config/nacos/client/NacosClient.java
@@ -30,6 +30,7 @@ import java.util.concurrent.*;
 import com.alibaba.nacos.api.NacosFactory;
 import com.alibaba.nacos.api.config.ConfigService;
 import com.alibaba.nacos.api.config.listener.Listener;
+
 import 
org.apache.servicecomb.config.nacos.archaius.sources.NacosConfigurationSourceImpl.UpdateHandler;
 import org.apache.servicecomb.foundation.common.utils.JsonUtils;
 import org.slf4j.Logger;
@@ -58,54 +59,57 @@ public class NacosClient {
   }
 
   public void refreshNacosConfig() {
-        new ConfigRefresh(serverAddr, dataId, group).refreshConfig();
+    new ConfigRefresh(serverAddr, dataId, group).refreshConfig();
   }
 
   class ConfigRefresh {
-      private final String serverAddr;
-      private final String dataId;
-      private final String group;
-      ConfigRefresh(String serverAddr,String dataId,String group) {
-          this.serverAddr = serverAddr;
-          this.dataId = dataId;
-          this.group = group;
-      }
+    private final String serverAddr;
+
+    private final String dataId;
+
+    private final String group;
+
+    ConfigRefresh(String serverAddr, String dataId, String group) {
+      this.serverAddr = serverAddr;
+      this.dataId = dataId;
+      this.group = group;
+    }
 
     @SuppressWarnings("unchecked")
     void refreshConfig() {
-          Properties properties = new Properties();
-          properties.put("serverAddr",serverAddr);
-          properties.put("dataId",dataId);
-          properties.put("group",group);
-      try{
+      Properties properties = new Properties();
+      properties.put("serverAddr", serverAddr);
+      properties.put("dataId", dataId);
+      properties.put("group", group);
+      try {
         ConfigService configService = 
NacosFactory.createConfigService(properties);
         String content = configService.getConfig(dataId, group, 5000);
         Map<String, Object> body = JsonUtils.OBJ_MAPPER.readValue(content,
-              new TypeReference<Map<String, Object>>() {
-              });
+            new TypeReference<Map<String, Object>>() {
+            });
         refreshConfigItems(body);
         configService.addListener(dataId, group, new Listener() {
           @Override
           public void receiveConfigInfo(String configInfo) {
-              LOGGER.info("receive from nacos:"+configInfo);
-              try {
-                  Map<String, Object> body = 
JsonUtils.OBJ_MAPPER.readValue(configInfo,
-                          new TypeReference<Map<String, Object>>() {
-                          });
-                  refreshConfigItems(body);
-              } catch (IOException e) {
-                  LOGGER.error("JsonObject parse config center response error: 
", e);
-              }
+            LOGGER.info("receive from nacos:" + configInfo);
+            try {
+              Map<String, Object> body = 
JsonUtils.OBJ_MAPPER.readValue(configInfo,
+                  new TypeReference<Map<String, Object>>() {
+                  });
+              refreshConfigItems(body);
+            } catch (IOException e) {
+              LOGGER.error("JsonObject parse config center response error: ", 
e);
+            }
           }
+
           @Override
           public Executor getExecutor() {
             return null;
           }
         });
-      }catch (Exception e){
-          LOGGER.error("Receive nacos config error: ", e);
+      } catch (Exception e) {
+        LOGGER.error("Receive nacos config error: ", e);
       }
-
     }
 
     private void refreshConfigItems(Map<String, Object> map) {

Reply via email to