gpt4 book ai didi

org.apache.ignite.spi.discovery.zk.internal.ZookeeperClient.needSplitNodeData()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 09:49:28 25 4
gpt4 key购买 nike

本文整理了Java中org.apache.ignite.spi.discovery.zk.internal.ZookeeperClient.needSplitNodeData()方法的一些代码示例,展示了ZookeeperClient.needSplitNodeData()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperClient.needSplitNodeData()方法的具体详情如下:
包路径:org.apache.ignite.spi.discovery.zk.internal.ZookeeperClient
类名称:ZookeeperClient
方法名:needSplitNodeData

ZookeeperClient.needSplitNodeData介绍

暂无

代码示例

代码示例来源:origin: apache/ignite

/**
 * @param path Path to save.
 * @param bytes Bytes to save.
 * @param overhead Extra overhead.
 * @return Parts count.
 * @throws Exception If failed.
 */
private int saveData(String path, byte[] bytes, int overhead) throws Exception {
  int dataForJoinedPartCnt = 1;
  if (rtState.zkClient.needSplitNodeData(path, bytes, overhead)) {
    dataForJoinedPartCnt = saveMultipleParts(rtState.zkClient,
      path,
      rtState.zkClient.splitNodeData(path, bytes, overhead));
  }
  else {
    rtState.zkClient.createIfNeeded(multipartPathName(path, 0),
      bytes,
      PERSISTENT);
  }
  return dataForJoinedPartCnt;
}

代码示例来源:origin: apache/ignite

/**
 * @param zkClient Client.
 * @param msgBytes Marshalled message.
 * @throws ZookeeperClientFailedException If connection to zk was lost.
 * @throws InterruptedException If interrupted.
 */
private void saveCustomMessage(ZookeeperClient zkClient, byte[] msgBytes)
  throws ZookeeperClientFailedException, InterruptedException
{
  String prefix = UUID.randomUUID().toString();
  int partCnt = 1;
  int overhead = 10;
  UUID locId = locNode.id();
  String path = zkPaths.createCustomEventPath(prefix, locId, partCnt);
  if (zkClient.needSplitNodeData(path, msgBytes, overhead)) {
    List<byte[]> parts = zkClient.splitNodeData(path, msgBytes, overhead);
    String partsBasePath = zkPaths.customEventPartsBasePath(prefix, locId);
    saveMultipleParts(zkClient, partsBasePath, parts);
    msgBytes = null;
    partCnt = parts.size();
  }
  zkClient.createSequential(prefix,
    zkPaths.customEvtsDir,
    zkPaths.createCustomEventPath(prefix, locId, partCnt),
    msgBytes,
    CreateMode.PERSISTENT_SEQUENTIAL);
}

代码示例来源:origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testSaveLargeValue() throws Exception {
  startZK(1);
  final ZookeeperClient client = createClient(SES_TIMEOUT);
  byte[] data = new byte[1024 * 1024];
  String basePath = "/ignite";
  assertTrue(client.needSplitNodeData(basePath, data, 2));
  List<byte[]> parts = client.splitNodeData(basePath, data, 2);
  assertTrue(parts.size() > 1);
  ZooKeeper zk = client.zk();
  for (int i = 0; i < parts.size(); i++) {
    byte[] part = parts.get(i);
    assertTrue(part.length > 0);
    String path0 = basePath + ":" + i;
    zk.create(path0, part, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
  }
}

代码示例来源:origin: apache/ignite

if (zkClient.needSplitNodeData(joinDataPath, joinDataBytes, OVERHEAD)) {
  List<byte[]> parts = zkClient.splitNodeData(joinDataPath, joinDataBytes, OVERHEAD);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com