use of com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl 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;
}
use of com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl in project dble by actiontech.
the class EcacheszkToxmlLoader method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
DirectoryInf rulesDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.CACHE, rulesDirectory);
ZkDirectoryImpl zkDirectory = (ZkDirectoryImpl) rulesDirectory.getSubordinateInfo().get(0);
zktoEhcacheWrite(zkDirectory);
LOGGER.info("EcacheszkToxmlLoader notifyProcess zk ehcache write success ");
return true;
}
use of com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl in project dble by actiontech.
the class ServerzkToxmlLoader method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
DirectoryInf serverDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.SERVER, serverDirectory);
ZkDirectoryImpl zkDirectory = (ZkDirectoryImpl) serverDirectory.getSubordinateInfo().get(0);
Server server = this.zktoServerBean(zkDirectory);
LOGGER.info("ServerzkToxmlLoader notifyProcess zk to object zk server Object :" + server);
String path = ResourceUtil.getResourcePathFromRoot(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey());
path = new File(path).getPath() + File.separator;
path += WRITEPATH;
LOGGER.info("ServerzkToxmlLoader notifyProcess zk to object writePath :" + path);
this.parseServerXMl.parseToXmlWrite(server, path, "server");
LOGGER.info("ServerzkToxmlLoader notifyProcess zk to object zk server write :" + path + " is success");
return true;
}
use of com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl in project dble by actiontech.
the class RuleszkToxmlLoader method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
DirectoryInf rulesDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.RULES, rulesDirectory);
ZkDirectoryImpl zkDirectory = (ZkDirectoryImpl) rulesDirectory.getSubordinateInfo().get(0);
Rules rules = this.zktoRulesBean(zkDirectory);
LOGGER.info("RuleszkToxmlLoader notifyProcess zk to object zk Rules Object :" + rules);
writeMapFileAddFunction(rules.getFunction());
LOGGER.info("RuleszkToxmlLoader notifyProcess write mapFile is success ");
String path = ResourceUtil.getResourcePathFromRoot(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey());
path = new File(path).getPath() + File.separator;
path = path + WRITEPATH;
LOGGER.info("RuleszkToxmlLoader notifyProcess zk to object writePath :" + path);
this.parseRulesXMl.parseToXmlWrite(rules, path, "rule");
LOGGER.info("RuleszkToxmlLoader notifyProcess zk to object zk Rules write :" + path + " is success");
return true;
}
use of com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ZkDirectoryImpl in project dble by actiontech.
the class SchemaszkToxmlLoader method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
DirectoryInf schemaDirectory = new ZkDirectoryImpl(currZkPath, null);
this.getTreeDirectory(currZkPath, KVPathUtil.SCHEMA, schemaDirectory);
ZkDirectoryImpl zkDirectory = (ZkDirectoryImpl) schemaDirectory.getSubordinateInfo().get(0);
Schemas schema = this.zktoSchemasBean(zkDirectory);
LOGGER.info("SchemasLoader notifyProcess zk to object zk schema Object :" + schema);
String path = ResourceUtil.getResourcePathFromRoot(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey());
path = new File(path).getPath() + File.separator;
path += WRITEPATH;
LOGGER.info("SchemasLoader notifyProcess zk to object writePath :" + path);
this.parseSchemaXmlService.parseToXmlWrite(schema, path, "schema");
LOGGER.info("SchemasLoader notifyProcess zk to object zk schema write :" + path + " is success");
return true;
}
Aggregations