use of com.actiontech.dble.config.loader.zkprocess.comm.NotifyService in project dble by actiontech.
the class ConfigStatusListener method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
if (DbleServer.getInstance().getFrontProcessors() != null) {
DirectoryInf statusDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.CONF_STATUS, statusDirectory);
ZkDataImpl zkData = (ZkDataImpl) statusDirectory.getSubordinateInfo().get(0);
ConfStatus status = new ConfStatus(zkData.getValue());
if (status.getFrom().equals(ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID))) {
// self node
return true;
}
LOGGER.info("ConfigStatusListener notifyProcess zk to object :" + status);
if (status.getStatus() == ConfStatus.Status.ROLLBACK) {
try {
RollbackConfig.rollback();
ZKUtils.createTempNode(KVPathUtil.getConfStatusPath(), ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), SUCCESS.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
String errorinfo = e.getMessage() == null ? e.toString() : e.getMessage();
ZKUtils.createTempNode(KVPathUtil.getConfStatusPath(), ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), errorinfo.getBytes(StandardCharsets.UTF_8));
}
return true;
}
for (NotifyService service : childService) {
try {
service.notifyProcess();
} catch (Exception e) {
LOGGER.warn(AlarmCode.CORE_ZK_WARN + "ConfigStatusListener notify error :" + service + " ,Exception info:", e);
}
}
try {
if (status.getStatus() == ConfStatus.Status.RELOAD_ALL) {
ReloadConfig.reloadAll(Integer.parseInt(status.getParams()));
} else {
ReloadConfig.reload();
}
ZKUtils.createTempNode(KVPathUtil.getConfStatusPath(), ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), SUCCESS.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
String errorinfo = e.getMessage() == null ? e.toString() : e.getMessage();
ZKUtils.createTempNode(KVPathUtil.getConfStatusPath(), ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), errorinfo.getBytes(StandardCharsets.UTF_8));
}
}
return true;
}
Aggregations