diff --git a/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java b/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java index 6b047b100..3123dd9b6 100644 --- a/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java +++ b/client/src/main/java/com/alibaba/nacos/client/config/listener/impl/PropertiesListener.java @@ -33,6 +33,7 @@ import java.util.Properties; public abstract class PropertiesListener extends AbstractListener { final static public Logger log = LogUtils.logger(PropertiesListener.class); + @Override public void receiveConfigInfo(String configInfo) { if (StringUtils.isEmpty(configInfo)) { return; diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java index 8e592568c..1cd66fb2c 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java @@ -252,7 +252,7 @@ public class ConfigController { inner.doPollingConfig(request, response, clientMd5Map, probeModify.length()); } - /* + /** * 订阅改配置的客户端信息 */ @RequestMapping(value = "/listener", method = RequestMethod.GET) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/HealthController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/HealthController.java index 3ff4fbd43..acd7e50e7 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/HealthController.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/HealthController.java @@ -64,17 +64,17 @@ public class HealthController { } else if (dbStatus.contains(heathWarnStr) && ServerListService.isAddressServerHealth() && ServerListService .isInIpList()) { sb.append("WARN:"); - sb.append("从数据库 ").append(dbStatus.split(":")[1]).append(" down. "); + sb.append("slave db (").append(dbStatus.split(":")[1]).append(") down. "); } else { sb.append("DOWN:"); if (dbStatus.contains(heathDownStr)) { - sb.append("主数据库 ").append(dbStatus.split(":")[1]).append(" down. "); + sb.append("master db (").append(dbStatus.split(":")[1]).append(") down. "); } if (!ServerListService.isAddressServerHealth()) { - sb.append("地址服务器 down. "); + sb.append("address server down. "); } if (!ServerListService.isInIpList()) { - sb.append("server ").append(LOCAL_IP).append(" 不在地址服务器的IP列表中. "); + sb.append("server ip ").append(LOCAL_IP).append(" is not in the serverList of address server. "); } } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ListenerController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ListenerController.java index aac841a09..537a84153 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ListenerController.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ListenerController.java @@ -48,7 +48,7 @@ public class ListenerController { @Autowired public ListenerController(ConfigSubService configSubService) {this.configSubService = configSubService;} - /* + /** * 获取客户端订阅配置信息 */ @RequestMapping(method = RequestMethod.GET) diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/OpsController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/OpsController.java index 9b303e945..4e588036d 100755 --- a/config/src/main/java/com/alibaba/nacos/config/server/controller/OpsController.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/OpsController.java @@ -15,9 +15,13 @@ */ package com.alibaba.nacos.config.server.controller; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + import com.alibaba.nacos.config.server.constant.Constants; import com.alibaba.nacos.config.server.service.PersistService; import com.alibaba.nacos.config.server.service.dump.DumpService; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -26,9 +30,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - /** * 管理控制器。 * @@ -50,7 +51,9 @@ public class OpsController { this.dumpService = dumpService; } - // ops call + /** + * ops call + */ @RequestMapping(value = "/localCache", method = RequestMethod.POST) @ResponseBody public String updateLocalCacheFromStore(HttpServletRequest request, HttpServletResponse respons) { diff --git a/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManagerMBean.java b/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManagerMBean.java index 9b25e97c3..a0f428533 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManagerMBean.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/manager/TaskManagerMBean.java @@ -28,6 +28,6 @@ public interface TaskManagerMBean { * * @return info */ - public String getTaskInfos(); + String getTaskInfos(); } diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/BasicDataSourceServiceImpl.java b/config/src/main/java/com/alibaba/nacos/config/server/service/BasicDataSourceServiceImpl.java index 7102326c3..96dfbce43 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/service/BasicDataSourceServiceImpl.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/service/BasicDataSourceServiceImpl.java @@ -15,7 +15,18 @@ */ package com.alibaba.nacos.config.server.service; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.annotation.PostConstruct; +import javax.sql.DataSource; + import com.alibaba.nacos.config.server.utils.PropertyUtil; + import org.apache.commons.dbcp.BasicDataSource; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; @@ -28,15 +39,6 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.stereotype.Service; import org.springframework.transaction.support.TransactionTemplate; -import javax.annotation.PostConstruct; -import javax.sql.DataSource; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - import static com.alibaba.nacos.common.util.SystemUtils.STANDALONE_MODE; import static com.alibaba.nacos.config.server.service.PersistService.CONFIG_INFO4BETA_ROW_MAPPER; import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog; @@ -51,9 +53,6 @@ import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog; public class BasicDataSourceServiceImpl implements DataSourceService { private static final String JDBC_DRIVER_NAME = "com.mysql.jdbc.Driver"; - @Autowired - private PropertyUtil propertyUtil; - /** * JDBC执行超时时间, 单位秒 */ @@ -109,7 +108,7 @@ public class BasicDataSourceServiceImpl implements DataSourceService { * 事务的超时时间需要与普通操作区分开 */ tjt.setTimeout(TRANSACTION_QUERY_TIMEOUT); - if (!STANDALONE_MODE || propertyUtil.isStandaloneUseMysql()) { + if (!STANDALONE_MODE || PropertyUtil.isStandaloneUseMysql()) { try { reload(); } catch (IOException e) { @@ -124,6 +123,7 @@ public class BasicDataSourceServiceImpl implements DataSourceService { } } + @Override public synchronized void reload() throws IOException { List dblist = new ArrayList(); try { @@ -201,6 +201,7 @@ public class BasicDataSourceServiceImpl implements DataSourceService { } } + @Override public boolean checkMasterWritable() { testMasterWritableJT.setDataSource(jt.getDataSource()); @@ -224,14 +225,17 @@ public class BasicDataSourceServiceImpl implements DataSourceService { } + @Override public JdbcTemplate getJdbcTemplate() { return this.jt; } + @Override public TransactionTemplate getTransactionTemplate() { return this.tjt; } + @Override public String getCurrentDBUrl() { DataSource ds = this.jt.getDataSource(); if (ds == null) { @@ -241,6 +245,7 @@ public class BasicDataSourceServiceImpl implements DataSourceService { return bds.getUrl(); } + @Override public String getHealth() { for (int i = 0; i < isHealthList.size(); i++) { if (!isHealthList.get(i)) { @@ -276,6 +281,7 @@ public class BasicDataSourceServiceImpl implements DataSourceService { } class SelectMasterTask implements Runnable { + @Override public void run() { defaultLog.info("check master db."); boolean isFound = false; @@ -309,6 +315,7 @@ public class BasicDataSourceServiceImpl implements DataSourceService { @SuppressWarnings("PMD.ClassNamingShouldBeCamelRule") class CheckDBHealthTask implements Runnable { + @Override public void run() { defaultLog.info("check db health."); String sql = "SELECT * FROM config_info_beta WHERE id = 1";