use of com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache in project dble by actiontech.
the class EcacheszkToxmlLoader method zktoEhcacheWrite.
/**
* zktoEhcacheWrite
*
* @param zkDirectory
* @return
* @Created 2016/9/17
*/
private void zktoEhcacheWrite(ZkDirectoryImpl zkDirectory) {
DataInf ehcacheZkDirectory = this.getZkData(zkDirectory, KVPathUtil.EHCACHE_NAME);
Ehcache ehcache = parseJsonEhcacheService.parseJsonToBean(ehcacheZkDirectory.getDataValue());
String outputPath = ResourceUtil.getResourcePathFromRoot(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey());
outputPath = new File(outputPath).getPath() + File.separator;
outputPath += KVPathUtil.EHCACHE_NAME;
parseEcacheXMl.parseToXmlWrite(ehcache, outputPath, null);
this.zookeeperListen.addWatch(KVPathUtil.getEhcacheNamePath(), this);
DataInf cacheserZkDirectory = this.getZkData(zkDirectory, KVPathUtil.CACHESERVER_NAME);
if (null != cacheserZkDirectory) {
ZkDataImpl cacheData = (ZkDataImpl) cacheserZkDirectory;
try {
ConfFileRWUtils.writeFile(cacheData.getName(), cacheData.getValue());
} catch (IOException e) {
LOGGER.warn(AlarmCode.CORE_ZK_WARN + "EcacheszkToxmlLoader wirteMapFile IOException", e);
}
this.zookeeperListen.addWatch(KVPathUtil.getCacheServerNamePath(), this);
}
}
use of com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache in project dble by actiontech.
the class UXmlEhcachesLoader method notifyProcess.
@Override
public void notifyProcess(UKvBean configValue) throws Exception {
UKvBean lock = ClusterUcoreSender.getKey(UcorePathUtil.getConfChangeLockPath());
if (UcoreConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID).equals(lock.getValue())) {
return;
}
JSONObject jsonObj = JSONObject.parseObject(configValue.getValue());
if (jsonObj.get(UcorePathUtil.EHCACHE) != null) {
Ehcache ehcache = parseJsonEhcacheService.parseJsonToBean(jsonObj.getJSONObject(UcorePathUtil.EHCACHE).toJSONString());
String path = ResourceUtil.getResourcePathFromRoot(UcorePathUtil.UCORE_LOCAL_WRITE_PATH);
path = new File(path).getPath() + File.separator + WRITEPATH;
this.parseEcacheXMl.parseToXmlWrite(ehcache, path, null);
}
}
use of com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache in project dble by actiontech.
the class UXmlEhcachesLoader method notifyCluster.
@Override
public void notifyCluster() throws Exception {
Ehcache ehcache = this.parseEcacheXMl.parseXmlToBean(UcorePathUtil.UCORE_LOCAL_WRITE_PATH + WRITEPATH);
JSONObject ehcacheObj = new JSONObject();
ehcacheObj.put(UcorePathUtil.EHCACHE, ehcache);
ClusterUcoreSender.sendDataToUcore(CONFIG_PATH, ehcacheObj.toJSONString());
}
use of com.actiontech.dble.config.loader.zkprocess.entity.cache.Ehcache in project dble by actiontech.
the class EcachesxmlTozkLoader method notifyProcess.
@Override
public boolean notifyProcess() throws Exception {
Ehcache ehcache = this.parseEcacheXMl.parseXmlToBean(ZookeeperPath.ZK_LOCAL_WRITE_PATH.getKey() + KVPathUtil.EHCACHE_NAME);
LOGGER.info("EhcachexmlTozkLoader notifyProcess xml to zk Ehcache Object :" + ehcache);
this.xmlTozkEhcacheJson(currZkPath, ehcache);
LOGGER.info("EhcachexmlTozkLoader notifyProcess xml to zk is success");
return true;
}
Aggregations