本文整理匯總了Java中org.I0Itec.zkclient.ZkClient.deleteRecursive方法的典型用法代碼示例。如果您正苦於以下問題:Java ZkClient.deleteRecursive方法的具體用法?Java ZkClient.deleteRecursive怎麽用?Java ZkClient.deleteRecursive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.I0Itec.zkclient.ZkClient
的用法示例。
在下文中一共展示了ZkClient.deleteRecursive方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validate
import org.I0Itec.zkclient.ZkClient; //導入方法依賴的package包/類
@Override
public void validate() throws ValidationException {
super.validate();
if (zkConnect == null || zkConnect.isEmpty())
throw new ValidationException(LOGGER.translate("ZKCONNECT_VALIDATE_ERROR"));
if (bootstrap == null || bootstrap.isEmpty())
throw new ValidationException(LOGGER.translate("BOOTSTRAP_VALIDATE_ERROR"));
if (topic == null || topic.isEmpty())
throw new ValidationException(LOGGER.translate("TOPIC_VALIDATE_ERROR"));
ZkClient zkClient = new ZkClient(zkConnect, 10000, 8000, ZKStringSerializer$.MODULE$);
// Security for Kafka was added in Kafka 0.9.0.0 -> isSecureKafkaCluster = false
ZkUtils zkUtils = new ZkUtils(zkClient, new ZkConnection(zkConnect), false);
if (AdminUtils.topicExists(zkUtils, topic))
zkClient.deleteRecursive(ZkUtils.getTopicPath(topic));
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(null);
AdminUtils.createTopic(zkUtils, topic, partitions, replicas, new Properties(), RackAwareMode.Disabled$.MODULE$);
}
catch (Throwable th) {
LOGGER.error(th.getMessage(), th);
throw new ValidationException(th.getMessage());
}
finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
zkClient.close();
}