gpt4 book ai didi

org.I0Itec.zkclient.ZkClient.deleteRecursive()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 12:22:40 28 4
gpt4 key购买 nike

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

ZkClient.deleteRecursive介绍

暂无

代码示例

代码示例来源:origin: killme2008/Metamorphosis

public static void deletePathRecursive(final ZkClient client, final String path) throws Exception {
  try {
    client.deleteRecursive(path);
  }
  catch (final ZkNoNodeException e) {
    logger.info(path + " deleted during connection loss; this is ok");
  }
  catch (final Exception e) {
    throw e;
  }
}

代码示例来源:origin: apache/incubator-pinot

final String zkPath = "/" + HELIX_CLUSTER_NAME;
if (_zkClient.exists(zkPath)) {
 _zkClient.deleteRecursive(zkPath);

代码示例来源:origin: uber/chaperone

@AfterTest
public void shutdown() {
 LOGGER.info("Trying to shutdown");
 for (FakeInstance fakeInstance : FAKE_INSTANCES) {
  try {
   LOGGER.info("Trying to shutdown: " + fakeInstance);
   fakeInstance.stop();
  } catch (Exception e) {
  }
 }
 LOGGER.info("Trying to stop controller");
 CONTROLLER_STARTER.stop();
 LOGGER.info("Trying to stop zk");
 kafkaBrokerTopicObserver.stop();
 KafkaStarterUtils.stopServer(kafkaStarter);
 
 ZK_CLIENT.deleteRecursive("/" + HELIX_CLUSTER_NAME);
 ZK_CLIENT.close();
 ZkStarter.stopLocalZkServer();
}

代码示例来源:origin: ezbz/projectx

@Override
 public boolean deleteRecursive(final String path) {
  return zkClient.deleteRecursive(path);
 }
}

代码示例来源:origin: Stratio/Decision

public void deleteTopics(){
  zkClient.deleteRecursive("/brokers/topics");
}

代码示例来源:origin: com.typesafe.akka/akka-zookeeper-mailbox

public void clear() {
 _zkClient.deleteRecursive(_rootPath);
}

代码示例来源:origin: com.stratio.decision/commons

public void deleteTopics(){
  zkClient.deleteRecursive("/brokers/topics");
}

代码示例来源:origin: uber/chaperone

ZK_CLIENT.deleteRecursive("/" + HELIX_CLUSTER_NAME);
REQUEST_URL = "http://localhost:" + CONTROLLER_PORT;
CONTROLLER_STARTER = startController(HELIX_CLUSTER_NAME, CONTROLLER_PORT);

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

@Override
 public void createDefaultNameSpace(org.I0Itec.zkclient.ZkClient client) {
  client.deleteRecursive("/" + clusterName);
 }
};

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

void deleteOldVersionPath(String path, List<String> zNodeIds, int numVersionsToLeave, Comparator<String> c) {
 if (StringUtils.isEmpty(path) || zNodeIds == null) {
  LOG.warn("cannot cleanup empty path or empty list in ZK");
  return;
 }
 if (zNodeIds.size() > numVersionsToLeave) {
  Collections.sort(zNodeIds, c);
  // get the znodes to delete
  int size = zNodeIds.size();
  List<String> zNodesToDelete = zNodeIds.subList(0, zNodeIds.size() - numVersionsToLeave);
  LOG.info("Starting cleanup of barrier version zkNodes. From size=" + size + " to size " + zNodesToDelete.size() + "; numberToLeave=" + numVersionsToLeave);
  for (String znodeId : zNodesToDelete) {
   String pathToDelete = path + "/" + znodeId;
   try {
    LOG.info("deleting " + pathToDelete);
    zkClient.deleteRecursive(pathToDelete);
    metrics.deletions.inc();
   } catch (Exception e) {
    LOG.warn("delete of node " + pathToDelete + " failed.", e);
   }
  }
 }
}
/**

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

@Override
 public void createDefaultNameSpace(org.I0Itec.zkclient.ZkClient zkClient) {
  if (rootNamespaces == null) {
   return;
  }
  for (String rootNamespace : rootNamespaces) {
   try {
    zkClient.deleteRecursive(rootNamespace);
   } catch (Exception e) {
    LOG.error("fail to deleteRecursive path:" + rootNamespace, e);
   }
  }
 }
};

代码示例来源:origin: com.github.sgroschupf/zkclient

public boolean deleteRecursive(String path) {
  List<String> children;
  try {
    children = getChildren(path, false);
  } catch (ZkNoNodeException e) {
    return true;
  }
  for (String subPath : children) {
    if (!deleteRecursive(path + "/" + subPath)) {
      return false;
    }
  }
  return delete(path);
}

代码示例来源:origin: com.101tec/zkclient

public boolean deleteRecursive(String path) {
  List<String> children;
  try {
    children = getChildren(path, false);
  } catch (ZkNoNodeException e) {
    return true;
  }
  for (String subPath : children) {
    if (!deleteRecursive(path + "/" + subPath)) {
      return false;
    }
  }
  return delete(path);
}

代码示例来源:origin: ezbz/projectx

@Before
@After
public void cleanup() {
 zkClient.deleteRecursive(TEST_PATH);
}

代码示例来源:origin: uber/uReplicator

@AfterTest
 public void shutdown() {
  LOGGER.info("Trying to shutdown");

  LOGGER.info("Trying to stop manager");
  MANAGER_STARTER.stop();

  KafkaStarterUtils.stopServer(kafkaStarter);

  ZK_CLIENT.deleteRecursive("/" + HELIX_CLUSTER_NAME);
  ZK_CLIENT.close();
  ZkStarter.stopLocalZkServer();
 }
}

代码示例来源:origin: uber/uReplicator

@BeforeTest
public void setup() throws ParseException {
 LOGGER.info("Trying to setup");
 ZkStarter.startLocalZkServer();
 kafkaStarter = KafkaStarterUtils.startServer(KafkaStarterUtils.DEFAULT_KAFKA_PORT,
   KafkaStarterUtils.DEFAULT_BROKER_ID,
   ZkStarter.DEFAULT_ZK_STR + "/cluster1", KafkaStarterUtils.getDefaultKafkaConfiguration());
 try {
  Thread.sleep(2000);
 } catch (Exception e) {
 }
 ZK_CLIENT = new ZkClient(ZkStarter.DEFAULT_ZK_STR);
 ZK_CLIENT.deleteRecursive("/" + HELIX_CLUSTER_NAME);
 REQUEST_URL = "http://localhost:" + MANAGER_PORT;
 MANAGER_STARTER = startManager(DEPLOYMENT_NAME, MANAGER_PORT);
 try {
  Thread.sleep(2000);
 } catch (InterruptedException e) {
  e.printStackTrace();
 }
}

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

@After
public void testTeardown() {
 testZkUtils.getZkClient().deleteRecursive(KEY_BUILDER.getRootPath());
 testZkUtils.close();
}

代码示例来源:origin: uber/uReplicator

@AfterTest
public void shutdown() {
 LOGGER.info("Trying to shutdown");
 for (FakeInstance fakeInstance : FAKE_INSTANCES) {
  try {
   LOGGER.info("Trying to shutdown: " + fakeInstance);
   fakeInstance.stop();
  } catch (Exception e) {
  }
 }
 LOGGER.info("Trying to stop controller");
 CONTROLLER_STARTER.stop();
 LOGGER.info("Trying to stop zk");
 kafkaBrokerTopicObserver.stop();
 KafkaStarterUtils.stopServer(kafkaStarter);
 ZK_CLIENT.deleteRecursive("/" + HELIX_CLUSTER_NAME);
 ZK_CLIENT.close();
 ZkStarter.stopLocalZkServer();
}

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

@After
public void testTeardown() {
 testZkUtils.getZkClient().deleteRecursive(KEY_BUILDER.getRootPath());
 testZkUtils.close();
}

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

@Test
public void testgetNextJobModelVersion() {
 // Set up the Zk base paths for testing.
 ZkKeyBuilder keyBuilder = new ZkKeyBuilder("test");
 String root = keyBuilder.getRootPath();
 zkClient.deleteRecursive(root);
 zkUtils.validatePaths(new String[]{root, keyBuilder.getJobModelPathPrefix(), keyBuilder.getJobModelVersionPath()});
 String version = "1";
 String oldVersion = "0";
 // Set zkNode JobModelVersion to 1.
 zkUtils.publishJobModelVersion(oldVersion, version);
 Assert.assertEquals(version, zkUtils.getJobModelVersion());
 // Publish JobModel with a higher version (2).
 zkUtils.publishJobModel("2", new JobModel(new MapConfig(), new HashMap<>()));
 // Get on the JobModel version should return 2, taking into account the published version 2.
 Assert.assertEquals("3", zkUtils.getNextJobModelVersion(zkUtils.getJobModelVersion()));
}

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