Optimization value equality comparison method.

pull/1517/head
MengJinLong 2 years ago
parent 265bf6ed70
commit 0d18347063

@ -194,10 +194,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