Strengthen the code (#7511)
This commit is contained in:
parent
c05f52ccb6
commit
27ed668695
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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()),
|
||||
|
Loading…
Reference in New Issue
Block a user