use of com.pamirs.pradar.pressurement.agent.event.impl.SilenceSwitchOffEvent in project LinkAgent by shulieTech.
the class SilenceSwitch method compareIsChangeAndSet.
@Override
public Boolean compareIsChangeAndSet(ClusterTestConfig config, Boolean newValue) {
boolean silenceSwitchOn = PradarSwitcher.silenceSwitchOn();
if (ObjectUtils.equals(newValue, silenceSwitchOn)) {
return Boolean.FALSE;
}
// 变更后配置更新到内存
if (newValue) {
SilenceSwitchOnEvent event = new SilenceSwitchOnEvent(this);
EventRouter.router().publish(event);
PradarSwitcher.turnSilenceSwitchOn();
config.setSilenceSwitchOn(true);
} else {
SilenceSwitchOffEvent event = new SilenceSwitchOffEvent(this);
EventRouter.router().publish(event);
PradarSwitcher.turnSilenceSwitchOff();
config.setSilenceSwitchOn(false);
}
if (LOGGER.isInfoEnabled()) {
LOGGER.info("publish silence switch config successful. config={}", newValue);
}
return Boolean.TRUE;
}
Aggregations