gpt4 book ai didi

org.apache.helix.manager.zk.ZkBaseDataAccessor.remove()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 21:50:03 33 4
gpt4 key购买 nike

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

ZkBaseDataAccessor.remove介绍

[英]Sync remove. it tries to remove the ZNode and all its descendants if any, node does not exist is regarded as success
[中]同步删除。它尝试删除ZNode及其所有子节点(如果有),节点不存在视为成功

代码示例

代码示例来源:origin: org.apache.helix/helix-core

@Override
public boolean[] remove(List<String> paths, int options) {
 final int size = paths.size();
 List<String> serverPaths = prependChroot(paths);
 Cache<T> cache = getCache(serverPaths);
 if (cache != null) {
  try {
   cache.lockWrite();
   boolean[] success = _baseAccessor.remove(serverPaths, options);
   for (int i = 0; i < size; i++) {
    if (success[i]) {
     cache.purgeRecursive(serverPaths.get(i));
    }
   }
   return success;
  } finally {
   cache.unlockWrite();
  }
 }
 // no cache
 return _baseAccessor.remove(serverPaths, options);
}

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

@Override
public boolean[] remove(List<String> paths, int options) {
 final int size = paths.size();
 List<String> serverPaths = prependChroot(paths);
 Cache<T> cache = getCache(serverPaths);
 if (cache != null) {
  try {
   cache.lockWrite();
   boolean[] success = _baseAccessor.remove(serverPaths, options);
   for (int i = 0; i < size; i++) {
    if (success[i]) {
     cache.purgeRecursive(serverPaths.get(i));
    }
   }
   return success;
  } finally {
   cache.unlockWrite();
  }
 }
 // no cache
 return _baseAccessor.remove(serverPaths, options);
}

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

@Override
public boolean remove(String path, int options) {
 String clientPath = path;
 String serverPath = prependChroot(clientPath);
 Cache<T> cache = getCache(serverPath);
 if (cache != null) {
  try {
   cache.lockWrite();
   boolean success = _baseAccessor.remove(serverPath, options);
   if (success) {
    cache.purgeRecursive(serverPath);
   }
   return success;
  } finally {
   cache.unlockWrite();
  }
 }
 // no cache
 return _baseAccessor.remove(serverPath, options);
}

代码示例来源:origin: org.apache.helix/helix-core

@Override
public boolean remove(String path, int options) {
 String clientPath = path;
 String serverPath = prependChroot(clientPath);
 Cache<T> cache = getCache(serverPath);
 if (cache != null) {
  try {
   cache.lockWrite();
   boolean success = _baseAccessor.remove(serverPath, options);
   if (success) {
    cache.purgeRecursive(serverPath);
   }
   return success;
  } finally {
   cache.unlockWrite();
  }
 }
 // no cache
 return _baseAccessor.remove(serverPath, options);
}

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

@Test
public void testSyncRemove() {
 String className = TestHelper.getTestClassName();
 String methodName = TestHelper.getTestMethodName();
 String testName = className + "_" + methodName;
 System.out.println("START " + testName + " at " + new Date(System.currentTimeMillis()));
 String path = String.format("/%s/%s", _rootPath, "msg_0");
 ZNRecord record = new ZNRecord("msg_0");
 ZkBaseDataAccessor<ZNRecord> accessor = new ZkBaseDataAccessor<ZNRecord>(_gZkClient);
 // Base data accessor shall not fail when remove a non-exist path
 boolean success = accessor.remove(path, 0);
 Assert.assertTrue(success);
 success = accessor.create(path, record, AccessOption.PERSISTENT);
 Assert.assertTrue(success);
 ZNRecord getRecord = _gZkClient.readData(path);
 Assert.assertNotNull(getRecord);
 Assert.assertEquals(getRecord.getId(), "msg_0");
 success = accessor.remove(path, 0);
 Assert.assertTrue(success);
 Assert.assertFalse(_gZkClient.exists(path));
 System.out.println("END " + testName + " at " + new Date(System.currentTimeMillis()));
}

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

success = extBaseAccessor.remove(paths, 0);
for (int i = 0; i < 10; i++) {
 Assert.assertTrue(success[i], "Should succeed in remove: " + paths.get(i));

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

paths.add(PropertyPathBuilder.instanceMessage(root, "host_1", msgId));
success = accessor.remove(paths, 0);
for (int i = 0; i < 10; i++) {
 String msgId = "msg_" + i;

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