format code: add @Override; translate some chinese msg to english; remove unneccessary method modifier

This commit is contained in:
FrankBian 2019-01-07 15:48:01 +08:00
parent 27ca776525
commit 41001899db
7 changed files with 35 additions and 24 deletions

View File

@ -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;

View File

@ -252,7 +252,7 @@ public class ConfigController {
inner.doPollingConfig(request, response, clientMd5Map, probeModify.length());
}
/*
/**
* 订阅改配置的客户端信息
*/
@RequestMapping(value = "/listener", method = RequestMethod.GET)

View File

@ -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. ");
}
}

View File

@ -48,7 +48,7 @@ public class ListenerController {
@Autowired
public ListenerController(ConfigSubService configSubService) {this.configSubService = configSubService;}
/*
/**
* 获取客户端订阅配置信息
*/
@RequestMapping(method = RequestMethod.GET)

View File

@ -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) {

View File

@ -28,6 +28,6 @@ public interface TaskManagerMBean {
*
* @return info
*/
public String getTaskInfos();
String getTaskInfos();
}

View File

@ -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<BasicDataSource> dblist = new ArrayList<BasicDataSource>();
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";