Strengthen the code (#7511)

This commit is contained in:
李晓双 Li Xiao Shuang 2022-01-07 18:09:55 +08:00 committed by GitHub
parent c05f52ccb6
commit 27ed668695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 14 deletions

View File

@ -33,7 +33,7 @@ public abstract class AbstractNacosTaskExecuteEngine<T extends NacosTask> implem
private final Logger log;
private final ConcurrentHashMap<Object, NacosTaskProcessor> taskProcessors = new ConcurrentHashMap<Object, NacosTaskProcessor>();
private final ConcurrentHashMap<Object, NacosTaskProcessor> taskProcessors = new ConcurrentHashMap<>();
private NacosTaskProcessor defaultTaskProcessor;

View File

@ -155,7 +155,7 @@ public class NacosDelayTaskExecuteEngine extends AbstractNacosTaskExecuteEngine<
retryFailedTask(taskKey, task);
}
} catch (Throwable e) {
getEngineLog().error("Nacos task execute error : " + e.toString(), e);
getEngineLog().error("Nacos task execute error ", e);
retryFailedTask(taskKey, task);
}
}

View File

@ -47,7 +47,7 @@ public class DumpConfigHandler extends Subscriber<ConfigDumpEvent> {
final String type = event.getType();
final long lastModified = event.getLastModifiedTs();
if (event.isBeta()) {
boolean result = false;
boolean result;
if (event.isRemove()) {
result = ConfigCacheService.removeBeta(dataId, group, namespaceId);
if (result) {

View File

@ -230,8 +230,7 @@ public abstract class DumpService {
}
} catch (Exception e) {
LogUtil.FATAL_LOG
.error("Nacos Server did not start because dumpservice bean construction failure :\n" + e
.toString());
.error("Nacos Server did not start because dumpservice bean construction failure :\n" + e);
throw new NacosException(NacosException.SERVER_ERROR,
"Nacos Server did not start because dumpservice bean construction failure :\n" + e.getMessage(),
e);
@ -337,9 +336,9 @@ public abstract class DumpService {
private Boolean isQuickStart() {
try {
String val = null;
String val;
val = EnvUtil.getProperty("isQuickStart");
if (val != null && TRUE_STR.equals(val)) {
if (TRUE_STR.equals(val)) {
isQuickStart = true;
}
FATAL_LOG.warn("isQuickStart:{}", isQuickStart);
@ -404,7 +403,7 @@ public abstract class DumpService {
static List<List<ConfigInfoChanged>> splitList(List<ConfigInfoChanged> list, int count) {
List<List<ConfigInfoChanged>> result = new ArrayList<List<ConfigInfoChanged>>(count);
for (int i = 0; i < count; i++) {
result.add(new ArrayList<ConfigInfoChanged>());
result.add(new ArrayList<>());
}
for (int i = 0; i < list.size(); i++) {
ConfigInfoChanged config = list.get(i);

View File

@ -68,9 +68,8 @@ public class DumpAllProcessor implements NacosTaskProcessor {
SwitchService.load(cf.getContent());
}
boolean result = ConfigCacheService
.dump(cf.getDataId(), cf.getGroup(), cf.getTenant(), cf.getContent(), cf.getLastModified(),
cf.getType());
ConfigCacheService.dump(cf.getDataId(), cf.getGroup(), cf.getTenant(), cf.getContent(),
cf.getLastModified(), cf.getType());
final String content = cf.getContent();
final String md5 = MD5Utils.md5Hex(content, Constants.ENCODE);

View File

@ -86,8 +86,8 @@ public class DumpChangeProcessor implements NacosTaskProcessor {
List<ConfigInfoWrapper> changeConfigs = persistService.findChangeConfig(startTime, endTime);
LogUtil.DEFAULT_LOG.warn("changeConfig count:{}", changeConfigs.size());
for (ConfigInfoWrapper cf : changeConfigs) {
boolean result = ConfigCacheService
.dumpChange(cf.getDataId(), cf.getGroup(), cf.getTenant(), cf.getContent(), cf.getLastModified());
ConfigCacheService.dumpChange(cf.getDataId(), cf.getGroup(), cf.getTenant(), cf.getContent(),
cf.getLastModified());
final String content = cf.getContent();
final String md5 = MD5Utils.md5Hex(content, Constants.ENCODE);
LogUtil.DEFAULT_LOG.info("[dump-change-ok] {}, {}, length={}, md5={}", GroupKey2.getKey(cf.getDataId(), cf.getGroup()),