Search in sources :

Example 1 with ZookeeperProcessListen

use of com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen in project dble by actiontech.

the class XmltoZkMain method writeConfFileToZK.

public static void writeConfFileToZK(boolean isAll, final int allMode) throws Exception {
    ZookeeperProcessListen zkListen = new ZookeeperProcessListen();
    CuratorFramework zkConn = ZKUtils.getConnection();
    XmlProcessBase xmlProcess = new XmlProcessBase();
    // xmltozk for schema
    new SchemasxmlTozkLoader(zkListen, zkConn, xmlProcess);
    // xmltozk for server
    new ServerxmlTozkLoader(zkListen, zkConn, xmlProcess);
    // xmltozk for rule
    new RulesxmlTozkLoader(zkListen, zkConn, xmlProcess);
    xmlProcess.initJaxbClass();
    zkListen.initAllNode();
    zkListen.clearInited();
    // write flag
    ConfStatus status = new ConfStatus(ZkConfig.getInstance().getValue(ClusterParamCfg.CLUSTER_CFG_MYID), isAll ? ConfStatus.Status.RELOAD_ALL : ConfStatus.Status.RELOAD, isAll ? String.valueOf(allMode) : null);
    zkConn.setData().forPath(KVPathUtil.getConfStatusPath(), status.toString().getBytes(StandardCharsets.UTF_8));
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ConfStatus(com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ConfStatus) XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) ZookeeperProcessListen(com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)

Example 2 with ZookeeperProcessListen

use of com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen in project dble by actiontech.

the class ZktoXmlMain method loadZktoFile.

/**
 * @throws Exception
 * @Created 2016/9/21
 */
public static void loadZktoFile() throws Exception {
    // get zk conn
    CuratorFramework zkConn = ZKUtils.getConnection();
    // if first start,init zk
    initZKIfNot(zkConn);
    // load zk listen
    ZookeeperProcessListen zkListen = new ZookeeperProcessListen();
    initLocalConfFromZK(zkListen, zkConn);
    // load watch
    loadZkWatch(zkListen.getWatchPath(), zkConn, zkListen);
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) ZookeeperProcessListen(com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)

Example 3 with ZookeeperProcessListen

use of com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen in project dble by actiontech.

the class XmltoZkMain method initFileToZK.

public static void initFileToZK() throws Exception {
    ZookeeperProcessListen zkListen = new ZookeeperProcessListen();
    CuratorFramework zkConn = ZKUtils.getConnection();
    XmlProcessBase xmlProcess = new XmlProcessBase();
    new SchemasxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new ServerxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new RulesxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new SequenceTozkLoader(zkListen, zkConn);
    new EcachesxmlTozkLoader(zkListen, zkConn, xmlProcess);
    new OthermsgTozkLoader(zkListen, zkConn);
    xmlProcess.initJaxbClass();
    zkListen.initAllNode();
    zkListen.clearInited();
    String confInited = KVPathUtil.getConfInitedPath();
    if (zkConn.checkExists().forPath(confInited) == null) {
        zkConn.create().creatingParentContainersIfNeeded().forPath(confInited);
    }
}
Also used : CuratorFramework(org.apache.curator.framework.CuratorFramework) XmlProcessBase(com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase) ZookeeperProcessListen(com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)

Aggregations

ZookeeperProcessListen (com.actiontech.dble.config.loader.zkprocess.comm.ZookeeperProcessListen)3 CuratorFramework (org.apache.curator.framework.CuratorFramework)3 XmlProcessBase (com.actiontech.dble.config.loader.zkprocess.parse.XmlProcessBase)2 ConfStatus (com.actiontech.dble.config.loader.zkprocess.zookeeper.process.ConfStatus)1