diff --git a/api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java b/api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java index 1e6e9a9db..a79d82cd6 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/ConfigFactory.java @@ -49,21 +49,14 @@ public class ConfigFactory { /** * Create Config * - * @param ServerAddr serverlist + * @param serverAddr serverList * @return Config * @throws NacosException Exception */ public static ConfigService createConfigService(String serverAddr) throws NacosException { Properties properties = new Properties(); properties.put(PropertyKeyConst.SERVER_ADDR, serverAddr); - try { - Class driverImplClass = Class.forName("com.alibaba.nacos.client.config.NacosConfigService"); - Constructor constructor = driverImplClass.getConstructor(Properties.class); - ConfigService vendorImpl = (ConfigService)constructor.newInstance(properties); - return vendorImpl; - } catch (Throwable e) { - throw new NacosException(-400, e.getMessage()); - } + return createConfigService(properties); } } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigContext.java b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigContext.java index 8cbff0e8e..4b82cf43e 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigContext.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigContext.java @@ -27,7 +27,7 @@ public interface IConfigContext { * @param key * @return context */ - public Object getParameter(String key); + Object getParameter(String key); /** * set context @@ -35,5 +35,5 @@ public interface IConfigContext { * @param key key * @param value value */ - public void setParameter(String key, Object value); + void setParameter(String key, Object value); } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilter.java b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilter.java index c8ae51251..bdc8f02f2 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilter.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilter.java @@ -24,7 +24,7 @@ import com.alibaba.nacos.api.exception.NacosException; */ public interface IConfigFilter { /** - * Init Fuction + * Init Function * * @param filterConfig Filter Config */ diff --git a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilterChain.java b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilterChain.java index 6c9ac180c..1ef90554f 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilterChain.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigFilterChain.java @@ -24,12 +24,12 @@ import com.alibaba.nacos.api.exception.NacosException; */ public interface IConfigFilterChain { /** - * Filter aciton + * Filter action * * @param request request * @param response response * @throws NacosException NacosException */ - public void doFilter(IConfigRequest request, IConfigResponse response) throws NacosException; + void doFilter(IConfigRequest request, IConfigResponse response) throws NacosException; } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigRequest.java b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigRequest.java index 176ea2553..428c39d39 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigRequest.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigRequest.java @@ -27,13 +27,13 @@ public interface IConfigRequest { * @param key key * @return value */ - public Object getParameter(String key); + Object getParameter(String key); /** * get config context * * @return */ - public IConfigContext getConfigContext(); + IConfigContext getConfigContext(); } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigResponse.java b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigResponse.java index 9dc707fed..872ab3a50 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigResponse.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/filter/IConfigResponse.java @@ -27,13 +27,13 @@ public interface IConfigResponse { * @param key key * @return value */ - public Object getParameter(String key); + Object getParameter(String key); /** * get context * * @return configContext */ - public IConfigContext getConfigContext(); + IConfigContext getConfigContext(); } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/filter/IFilterConfig.java b/api/src/main/java/com/alibaba/nacos/api/config/filter/IFilterConfig.java index a625710e2..c0bf63224 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/filter/IFilterConfig.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/filter/IFilterConfig.java @@ -27,7 +27,7 @@ public interface IFilterConfig { * * @return */ - public String getFilterName(); + String getFilterName(); /** * get param @@ -35,6 +35,6 @@ public interface IFilterConfig { * @param name * @return param */ - public Object getInitParameter(String name); + Object getInitParameter(String name); } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/listener/AbstractListener.java b/api/src/main/java/com/alibaba/nacos/api/config/listener/AbstractListener.java index 645f6545c..251ec0a42 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/listener/AbstractListener.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/listener/AbstractListener.java @@ -18,7 +18,7 @@ package com.alibaba.nacos.api.config.listener; import java.util.concurrent.Executor; /** - * Listner Adapter,use default notify thread + * Listener Adapter,use default notify thread * * @author water.lyl */ @@ -28,6 +28,7 @@ public abstract class AbstractListener implements Listener { /** * use default Executor */ + @Override public Executor getExecutor() { return null; } diff --git a/api/src/main/java/com/alibaba/nacos/api/config/listener/Listener.java b/api/src/main/java/com/alibaba/nacos/api/config/listener/Listener.java index 2a9fc5103..abaed12a7 100644 --- a/api/src/main/java/com/alibaba/nacos/api/config/listener/Listener.java +++ b/api/src/main/java/com/alibaba/nacos/api/config/listener/Listener.java @@ -25,16 +25,16 @@ import java.util.concurrent.Executor; public interface Listener { /** - * Executor to excute this receive + * Executor to execute this receive * * @return Executor */ - public Executor getExecutor(); + Executor getExecutor(); /** * 接收配置信息 * * @param configInfo 配置值 */ - public void receiveConfigInfo(final String configInfo); + void receiveConfigInfo(final String configInfo); } diff --git a/example/src/main/java/com/alibaba/nacos/example/ConfigExample.java b/example/src/main/java/com/alibaba/nacos/example/ConfigExample.java index d6ab57af1..bf628d370 100644 --- a/example/src/main/java/com/alibaba/nacos/example/ConfigExample.java +++ b/example/src/main/java/com/alibaba/nacos/example/ConfigExample.java @@ -42,7 +42,7 @@ public class ConfigExample { configService.addListener(dataId, group, new Listener() { @Override public void receiveConfigInfo(String configInfo) { - System.out.println("recieve:" + configInfo); + System.out.println("receive:" + configInfo); } @Override