optimization the method of checkNotifyConsistencyAndReplace

pull/1514/head
MengJinLong 2 years ago
parent 265bf6ed70
commit 322a934728

@ -166,7 +166,6 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
private void checkNotifyConsistencyAndReplace(ExecutorProperties executorProperties) { private void checkNotifyConsistencyAndReplace(ExecutorProperties executorProperties) {
boolean checkNotifyConfig = false; boolean checkNotifyConfig = false;
boolean checkNotifyAlarm = false; boolean checkNotifyAlarm = false;
List<String> changeKeys = new ArrayList<>();
Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap = Map<String, List<NotifyConfigDTO>> newDynamicThreadPoolNotifyMap =
configModeNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties); configModeNotifyConfigBuilder.buildSingleNotifyConfig(executorProperties);
Map<String, List<NotifyConfigDTO>> notifyConfigs = threadPoolBaseSendMessageService.getNotifyConfigs(); Map<String, List<NotifyConfigDTO>> notifyConfigs = threadPoolBaseSendMessageService.getNotifyConfigs();
@ -179,7 +178,6 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
for (NotifyConfigDTO notifyConfig : each.getValue()) { for (NotifyConfigDTO notifyConfig : each.getValue()) {
if (!notifyConfigDTOS.contains(notifyConfig)) { if (!notifyConfigDTOS.contains(notifyConfig)) {
checkNotifyConfig = true; checkNotifyConfig = true;
changeKeys.add(each.getKey());
break; break;
} }
} }
@ -194,10 +192,9 @@ public class DynamicThreadPoolRefreshListener extends AbstractRefreshListener<Ex
Boolean isAlarm = executorProperties.getAlarm(); Boolean isAlarm = executorProperties.getAlarm();
Integer activeAlarm = executorProperties.getActiveAlarm(); Integer activeAlarm = executorProperties.getActiveAlarm();
Integer capacityAlarm = executorProperties.getCapacityAlarm(); Integer capacityAlarm = executorProperties.getCapacityAlarm();
// FIXME Compare using Objects.equals if ((isAlarm != null && !Objects.equals(isAlarm,threadPoolNotifyAlarm.getAlarm()))
if ((isAlarm != null && isAlarm != threadPoolNotifyAlarm.getAlarm()) || (activeAlarm != null && !Objects.equals(activeAlarm,threadPoolNotifyAlarm.getActiveAlarm()))
|| (activeAlarm != null && activeAlarm != threadPoolNotifyAlarm.getActiveAlarm()) || (capacityAlarm != null && !Objects.equals(capacityAlarm,threadPoolNotifyAlarm.getCapacityAlarm()))) {
|| (capacityAlarm != null && capacityAlarm != threadPoolNotifyAlarm.getCapacityAlarm())) {
checkNotifyAlarm = true; checkNotifyAlarm = true;
threadPoolNotifyAlarm.setAlarm(Optional.ofNullable(isAlarm).orElse(threadPoolNotifyAlarm.getAlarm())); threadPoolNotifyAlarm.setAlarm(Optional.ofNullable(isAlarm).orElse(threadPoolNotifyAlarm.getAlarm()));
threadPoolNotifyAlarm.setActiveAlarm(Optional.ofNullable(activeAlarm).orElse(threadPoolNotifyAlarm.getActiveAlarm())); threadPoolNotifyAlarm.setActiveAlarm(Optional.ofNullable(activeAlarm).orElse(threadPoolNotifyAlarm.getActiveAlarm()));

Loading…
Cancel
Save