當前位置: 首頁>>代碼示例>>Java>>正文


Java ZKPaths.mkdirs方法代碼示例

本文整理匯總了Java中org.apache.curator.utils.ZKPaths.mkdirs方法的典型用法代碼示例。如果您正苦於以下問題:Java ZKPaths.mkdirs方法的具體用法?Java ZKPaths.mkdirs怎麽用?Java ZKPaths.mkdirs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.curator.utils.ZKPaths的用法示例。


在下文中一共展示了ZKPaths.mkdirs方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPath

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
/**
 * 創建配製信息
 * 方法描述
 * @param configKey 配製的當前路徑名稱信息
 * @param filterInnerMap  最終的信息是否為map
 * @param configDirectory 配製的目錄
 * @param restDirectory 子目錄信息
 * @創建日期 2016年9月11日
 */
public boolean createPath(String path) {

    // 得到當前的目錄信息
    LOGGER.trace("createPath child path is {}", path);

    boolean result = true;
    try {
        // 進行目錄的創建操作
        ZKPaths.mkdirs(curator.getZookeeperClient().getZooKeeper(), path);
    } catch (Exception e) {
        LOGGER.error(" createPath error", e);
        result = false;
    }

    return result;
}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:26,代碼來源:ZkMultLoader.java

示例2: main

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
/**
 * 測試入口
 */
public static void main(String[] args) throws Exception {
	client.start();

	ZooKeeper zookeeper = client.getZookeeperClient().getZooKeeper();

	System.out.println(ZKPaths.fixForNamespace(path, "sub"));
	System.out.println(ZKPaths.makePath(path, "sub"));

	System.out.println(ZKPaths.getNodeFromPath(path + "/sub1"));

	PathAndNode pn = ZKPaths.getPathAndNode(path + "/sub1");
	System.out.println(pn.getPath());
	System.out.println(pn.getNode());

	String path1 = path + "/child1";
	String path2 = path + "/child2";
	ZKPaths.mkdirs(zookeeper, path1);
	ZKPaths.mkdirs(zookeeper, path2);
	System.out.println(ZKPaths.getSortedChildren(zookeeper, path));

	ZKPaths.deleteChildren(zookeeper, path, true);
}
 
開發者ID:bdceo,項目名稱:bd-codes,代碼行數:26,代碼來源:CuratorZKPathsTest.java

示例3: notiflyProcess

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
@Override
public boolean notiflyProcess() throws Exception {
    // 添加line目錄,用作集群中節點,在線的基本目錄信息
    String line = currZkPath + ZookeeperPath.ZK_SEPARATOR.getKey() + ZookeeperPath.FLOW_ZK_PATH_LINE.getKey();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), line);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + line + " success");

    // 添加序列目錄信息
    String seqLine = currZkPath + ZookeeperPath.ZK_SEPARATOR.getKey()
            + ZookeeperPath.FLOW_ZK_PATH_SEQUENCE.getKey();
    seqLine = seqLine + ZookeeperPath.ZK_SEPARATOR.getKey() + ZookeeperPath.FLOW_ZK_PATH_SEQUENCE_INSTANCE.getKey();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), seqLine);

    String seqLeader = currZkPath + ZookeeperPath.ZK_SEPARATOR.getKey()
            + ZookeeperPath.FLOW_ZK_PATH_SEQUENCE.getKey();
    seqLeader = seqLeader + ZookeeperPath.ZK_SEPARATOR.getKey()
            + ZookeeperPath.FLOW_ZK_PATH_SEQUENCE_LEADER.getKey();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), seqLeader);

    String incrSeq = currZkPath + ZookeeperPath.ZK_SEPARATOR.getKey()
            + ZookeeperPath.FLOW_ZK_PATH_SEQUENCE.getKey();
    incrSeq = incrSeq + ZookeeperPath.ZK_SEPARATOR.getKey()
            + ZookeeperPath.FLOW_ZK_PATH_SEQUENCE_INCREMENT_SEQ.getKey();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), incrSeq);

    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + seqLine + " success");
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + seqLeader + " success");
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + incrSeq + " success");

    return true;
}
 
開發者ID:huang-up,項目名稱:mycat-src-1.6.1-RELEASE,代碼行數:32,代碼來源:OthermsgTozkLoader.java

示例4: setZkNodeData

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
public void setZkNodeData(String zkNodePath, byte[] data) throws Exception {
    Stat stat = curator.checkExists().forPath(zkNodePath);
    if (stat == null) {
        ZKPaths.mkdirs(curator.getZookeeperClient().getZooKeeper(), zkNodePath);
    }

    curator.setData().inBackground().forPath(zkNodePath, data);
}
 
開發者ID:variflight,項目名稱:feeyo-redisproxy,代碼行數:9,代碼來源:ZkClient.java

示例5: createPath

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
public boolean createPath(String path) {

        LOGGER.trace("createPath child path is {}", path);

        boolean result = true;
        try {
            ZKPaths.mkdirs(curator.getZookeeperClient().getZooKeeper(), path);
        } catch (Exception e) {
            LOGGER.warn(AlarmCode.CORE_ZK_WARN + " createPath error", e);
            result = false;
        }

        return result;
    }
 
開發者ID:actiontech,項目名稱:dble,代碼行數:15,代碼來源:ZkMultiLoader.java

示例6: addInSync

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
private static void addInSync(String path, long delta){
    try {
        ZKPaths.mkdirs(CURATOR_FRAMEWORK.getZookeeperClient().getZooKeeper(), path);
        COUNTERS.putIfAbsent(path, new DistributedAtomicLong(CURATOR_FRAMEWORK, path, RETRY_N_TIMES));
        DistributedAtomicLong counter = COUNTERS.get(path);
        AtomicValue<Long> returnValue = counter.add(delta);
        while (!returnValue.succeeded()) {
            returnValue = counter.add(delta);
        }
    }catch (Exception e){
        LOGGER.error("addInSync "+delta+" failed for "+path, e);
    }
}
 
開發者ID:ysc,項目名稱:counter,代碼行數:14,代碼來源:AtomicCounter.java

示例7: subtract

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
private static void subtract(String path, long delta){
    try {
        ZKPaths.mkdirs(CURATOR_FRAMEWORK.getZookeeperClient().getZooKeeper(), path);
        COUNTERS.putIfAbsent(path, new DistributedAtomicLong(CURATOR_FRAMEWORK, path, RETRY_N_TIMES));
        DistributedAtomicLong counter = COUNTERS.get(path);
        AtomicValue<Long> returnValue = counter.subtract(delta);
        while (!returnValue.succeeded()) {
            returnValue = counter.subtract(delta);
        }
    }catch (Exception e){
        LOGGER.error("subtract "+delta+" failed for "+path, e);
    }
}
 
開發者ID:ysc,項目名稱:counter,代碼行數:14,代碼來源:AtomicCounter.java

示例8: setLimit

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
public static boolean setLimit(String apiType, long newLimit){
    try{
        LOGGER.info("修改最大限製值, apiType: {}, 現有最大限製值為: {}, 修改為: {}", apiType, getLimit(apiType), newLimit);
        String path = MAX_API_CALL_COUNT_LIMIT + "_" + apiType;
        ZKPaths.mkdirs(CURATOR_FRAMEWORK.getZookeeperClient().getZooKeeper(), path);
        CURATOR_FRAMEWORK.setData().forPath(path, String.valueOf(newLimit).getBytes());
        LOGGER.info("成功為apiType: {} 設置最大限製值: {}", apiType, newLimit);
        return true;
    }catch (Exception e){
        LOGGER.error("為apiType: "+apiType+" 指定的最大限製值: "+newLimit+" 非法", e);
    }
    return false;
}
 
開發者ID:ysc,項目名稱:counter,代碼行數:14,代碼來源:CountLimit.java

示例9: notifyProcess

import org.apache.curator.utils.ZKPaths; //導入方法依賴的package包/類
@Override
public boolean notifyProcess() throws Exception {
    String line = KVPathUtil.getOnlinePath();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), line);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + line + " success");

    String seqLine = KVPathUtil.getSequencesInstancePath();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), seqLine);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + seqLine + " success");

    String seqLeader = KVPathUtil.getSequencesLeaderPath();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), seqLeader);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + seqLeader + " success");

    String incrSeq = KVPathUtil.getSequencesIncrPath();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), incrSeq);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + incrSeq + " success");

    String binlogPauseStatusPath = KVPathUtil.getBinlogPauseStatus();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), binlogPauseStatusPath);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + binlogPauseStatusPath + " success");

    String binlogPauseInstances = KVPathUtil.getBinlogPauseInstance();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), binlogPauseInstances);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + binlogPauseInstances + " success");

    String ddlPath = KVPathUtil.getDDLPath();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), ddlPath);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + ddlPath + " success");

    String confStatusPath = KVPathUtil.getConfStatusPath();
    ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), confStatusPath);
    LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + confStatusPath + " success");

    String lockBasePathPath = KVPathUtil.getLockBasePath();
    if (this.getCurator().checkExists().forPath(lockBasePathPath) == null) {
        ZKPaths.mkdirs(this.getCurator().getZookeeperClient().getZooKeeper(), lockBasePathPath);
        LOGGER.info("OthermsgTozkLoader zookeeper mkdir " + lockBasePathPath + " success");
    }
    return true;
}
 
開發者ID:actiontech,項目名稱:dble,代碼行數:42,代碼來源:OthermsgTozkLoader.java


注:本文中的org.apache.curator.utils.ZKPaths.mkdirs方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。