import org.apache.helix.manager.zk.ZkClient; //導入方法依賴的package包/類

private static void zkCopy(ZkClient srcClient, String srcRootPath, ZkClient dstClient, String dstRootPath) {

// Strip off tailing "/"

if (!srcRootPath.equals("/") && srcRootPath.endsWith("/")) {

srcRootPath = srcRootPath.substring(0, srcRootPath.length() - 1);

}

if (!dstRootPath.equals("/") && dstRootPath.endsWith("/")) {

dstRootPath = dstRootPath.substring(0, dstRootPath.length() - 1);

}

// Validate paths

PathUtils.validatePath(srcRootPath);

PathUtils.validatePath(dstRootPath);

if (srcRootPath.equals(dstRootPath)) {

logger.info("srcPath == dstPath. Skip copying");

return;

}

if (srcRootPath.startsWith(dstRootPath) || dstRootPath.startsWith(srcRootPath)) {

throw new IllegalArgumentException(

"srcPath/dstPath can't be prefix of dstPath/srcPath, was srcPath: " + srcRootPath

+ ", dstPath: " + dstRootPath);

}

// Recursive copy using BFS

List queue = new LinkedList();

String root = "";

copy(srcClient, srcRootPath, dstClient, dstRootPath, Arrays.asList(root));

queue.add(root);

while (!queue.isEmpty()) {

String path = queue.remove(0);

String fromPath = concatenate(srcRootPath, path);

List children = srcClient.getChildren(fromPath);

List paths = new ArrayList();

if (children != null && children.size() > 0) {

for (String child : children) {

String childPath = concatenate(path, child);

paths.add(childPath);

}

copy(srcClient, srcRootPath, dstClient, dstRootPath, paths);

queue.addAll(paths);

}

}

}

java getchildren用法_Java ZkClient.getChildren方法代碼示例相关推荐

  1. java中move用法_Java IFile.move方法代碼示例

    import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類 /** * * 01. Class0 uses Class1 in requi ...

  2. java drawrect负数_Java Graphics.drawRect方法代碼示例

    import javax.microedition.lcdui.Graphics; //導入方法依賴的package包/類 /** * Draws the item. * * @param g Gra ...

  3. java中reject方法作用_Java BindingResult.rejectValue方法代碼示例

    本文整理匯總了Java中org.springframework.validation.BindingResult.rejectValue方法的典型用法代碼示例.如果您正苦於以下問題:Java Bind ...

  4. java touch创建文件_Java FileUtils.touch方法代碼示例

    本文整理匯總了Java中org.apache.commons.io.FileUtils.touch方法的典型用法代碼示例.如果您正苦於以下問題:Java FileUtils.touch方法的具體用法? ...

  5. java使用drawtext重叠_Java Graphics.drawText方法代碼示例

    本文整理匯總了Java中org.eclipse.draw2d.Graphics.drawText方法的典型用法代碼示例.如果您正苦於以下問題:Java Graphics.drawText方法的具體用法 ...

  6. java getitem方法_Java Datasource.getItem方法代碼示例

    本文整理匯總了Java中com.haulmont.cuba.gui.data.Datasource.getItem方法的典型用法代碼示例.如果您正苦於以下問題:Java Datasource.getI ...

  7. java fileitem 识别图片大小_Java FileItem.getSize方法代碼示例

    本文整理匯總了Java中org.apache.commons.fileupload.FileItem.getSize方法的典型用法代碼示例.如果您正苦於以下問題:Java FileItem.getSi ...

  8. java nio keyiterator.remove()_Java SelectionKey.isValid方法代碼示例

    本文整理匯總了Java中java.nio.channels.SelectionKey.isValid方法的典型用法代碼示例.如果您正苦於以下問題:Java SelectionKey.isValid方法 ...

  9. java findpage 方法_Java Strings.isNotBlank方法代碼示例

    本文整理匯總了Java中de.invesdwin.util.lang.Strings.isNotBlank方法的典型用法代碼示例.如果您正苦於以下問題:Java Strings.isNotBlank方 ...

  10. java版本的getorcreate_Java ContainerUtil.getOrCreate方法代碼示例

    本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.getOrCreate方法的典型用法代碼示例.如果您正苦於以下問題:Java Contai ...

最新文章

  1. 主成分分析、因子分析、聚类分析的比较与应用
  2. 6. Oracle闪回特性
  3. php中public放什么,PHP中常用关键字public, private, protected, static...
  4. 经常会提到的Java面试题
  5. RPC框架性能基本比较测试
  6. 开头和结尾标记 在不同系统_写人作文的写作技巧。含思维导图、开头结尾写法及范文分析...
  7. Attention的梳理、随想与尝试
  8. matlab设计译码器,基于MATLAB的循环码编译码器设计与仿真.doc
  9. P3803 【模板】多项式乘法(FFT)
  10. [微软官网] SQLSERVER 执行页面还原
  11. 关于AD导Gerber文件的理解和总结
  12. python统计图的三层结构设计_中大型LABVIEW软件三层设计架构(带图片目录完整版)...
  13. 创建数据透视表数据包含合并单元格
  14. 知识| 四种渲染到底是啥?终于有人讲明白了(上)
  15. ARM ELF 镜像结构
  16. Mysql数据库学习笔记[完结]
  17. [翻译]Reactor Netty参考指南 - 8.UDP客户端
  18. vue+腾讯地图标记弹框
  19. python字符串str_python3 字符串str 教程
  20. 数据库系统设计_银行业务管理系统

热门文章

  1. 软件测试的学习之路------软件质量
  2. matlab ann-bp分类器,利用matlab真的BP-ANN分类器设计.doc
  3. unity创建项目报错:解决sentinel key not found (h0007) Unity
  4. 什么是git_什么是Git?
  5. 安卓 开源 挣钱_在开源中赚钱并享受乐趣
  6. 搭建网站随笔(WordPress)
  7. html(+css)/02/html标记语义应用,html列表与图片的应用
  8. java/03/类与对象,深入分析类与对象(权限修饰,构造方法和简单java类),数组的定义及使用
  9. 第二十二章:洗净皮衣
  10. Bootstrap3 表单控件的状态