Search in sources :

Example 1 with CommandPathListener

use of io.mycat.config.loader.zkprocess.zktoxml.command.CommandPathListener in project Mycat_plus by coderczp.

the class ZktoXmlMain method runCommandWatch.

/**
 * 进行命令的监听操作
 * 方法描述
 * @param zkConn zk的连接信息
 * @param path 路径信息
 * @param ZKLISTENER 监控路径信息
 * @throws Exception
 * @创建日期 2016年9月20日
 */
@SuppressWarnings("resource")
private static void runCommandWatch(final CuratorFramework zkConn, final String path) throws Exception {
    PathChildrenCache children = new PathChildrenCache(zkConn, path, true);
    CommandPathListener commandListener = new CommandPathListener();
    // 移除原来的监听再进行添加
    children.getListenable().addListener(commandListener);
    children.start();
}
Also used : PathChildrenCache(org.apache.curator.framework.recipes.cache.PathChildrenCache) CommandPathListener(io.mycat.config.loader.zkprocess.zktoxml.command.CommandPathListener)

Example 2 with CommandPathListener

use of io.mycat.config.loader.zkprocess.zktoxml.command.CommandPathListener in project Mycat-Server by MyCATApache.

the class ZktoXmlMain method runCommandWatch.

/**
 * 进行命令的监听操作
 * 方法描述
 * @param zkConn zk的连接信息
 * @param path 路径信息
 * @param ZKLISTENER 监控路径信息
 * @throws Exception
 * @创建日期 2016年9月20日
 */
@SuppressWarnings("resource")
private static void runCommandWatch(final CuratorFramework zkConn, final String path) throws Exception {
    PathChildrenCache children = new PathChildrenCache(zkConn, path, true);
    CommandPathListener commandListener = new CommandPathListener();
    // 移除原来的监听再进行添加
    children.getListenable().addListener(commandListener);
    children.start();
}
Also used : PathChildrenCache(org.apache.curator.framework.recipes.cache.PathChildrenCache) CommandPathListener(io.mycat.config.loader.zkprocess.zktoxml.command.CommandPathListener)

Aggregations

CommandPathListener (io.mycat.config.loader.zkprocess.zktoxml.command.CommandPathListener)2 PathChildrenCache (org.apache.curator.framework.recipes.cache.PathChildrenCache)2