本文整理汇总了Java中org.apache.zookeeper.ZKUtil.deleteRecursive方法的典型用法代码示例。如果您正苦于以下问题:Java ZKUtil.deleteRecursive方法的具体用法?Java ZKUtil.deleteRecursive怎么用?Java ZKUtil.deleteRecursive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.zookeeper.ZKUtil
的用法示例。
在下文中一共展示了ZKUtil.deleteRecursive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteLog
import org.apache.zookeeper.ZKUtil; //导入方法依赖的package包/类
public void deleteLog() throws IOException {
lock.checkOwnershipAndReacquire();
FutureUtils.result(purgeLogSegmentsOlderThanTxnId(-1));
try {
Utils.closeQuietly(lock);
zooKeeperClient.get().exists(logMetadata.getLogSegmentsPath(), false);
zooKeeperClient.get().exists(logMetadata.getMaxTxIdPath(), false);
if (logMetadata.getLogRootPath().toLowerCase().contains("distributedlog")) {
ZKUtil.deleteRecursive(zooKeeperClient.get(), logMetadata.getLogRootPath());
} else {
LOG.warn("Skip deletion of unrecognized ZK Path {}", logMetadata.getLogRootPath());
}
} catch (InterruptedException ie) {
LOG.error("Interrupted while deleting log znodes", ie);
throw new DLInterruptedException("Interrupted while deleting " + logMetadata.getLogRootPath(), ie);
} catch (KeeperException ke) {
LOG.error("Error deleting" + logMetadata.getLogRootPath() + " in zookeeper", ke);
}
}
示例2: close
import org.apache.zookeeper.ZKUtil; //导入方法依赖的package包/类
/**
* Disconnects from ZooKeeper
*
* @param p_delete
* if true alle ZooKeeper nodes are deleted
* @throws ZooKeeperException
* if ZooKeeper could not accessed
*/
public synchronized void close(final boolean p_delete) throws ZooKeeperException {
if (m_zookeeper != null) {
try {
if (p_delete) {
ZKUtil.deleteRecursive(m_zookeeper, m_path);
}
m_zookeeper.close();
} catch (final InterruptedException | KeeperException e) {
throw new ZooKeeperException("Could not access ZooKeeper", e);
}
m_zookeeper = null;
}
}
示例3: exec
import org.apache.zookeeper.ZKUtil; //导入方法依赖的package包/类
@Override
public boolean exec() throws KeeperException,
InterruptedException {
printDeprecatedWarning();
String path = args[1];
ZKUtil.deleteRecursive(zk, path);
return false;
}
示例4: delete
import org.apache.zookeeper.ZKUtil; //导入方法依赖的package包/类
/**
* Delete all the partitions of the specified log
*
* @throws IOException if the deletion fails
*/
@Override
public void delete() throws IOException {
BKLogWriteHandler ledgerHandler = createWriteHandler(true);
try {
ledgerHandler.deleteLog();
} finally {
Utils.closeQuietly(ledgerHandler);
}
// Delete the ZK path associated with the log stream
String zkPath = getZKPath();
// Safety check when we are using the shared zookeeper
if (zkPath.toLowerCase().contains("distributedlog")) {
try {
LOG.info("Delete the path associated with the log {}, ZK Path {}", name, zkPath);
ZKUtil.deleteRecursive(writerZKC.get(), zkPath);
} catch (InterruptedException ie) {
LOG.error("Interrupted while accessing ZK", ie);
throw new DLInterruptedException("Error initializing zk", ie);
} catch (KeeperException ke) {
LOG.error("Error accessing entry in zookeeper", ke);
throw new IOException("Error initializing zk", ke);
}
} else {
LOG.warn("Skip deletion of unrecognized ZK Path {}", zkPath);
}
}
示例5: deleteZkNode
import org.apache.zookeeper.ZKUtil; //导入方法依赖的package包/类
@Test
public void deleteZkNode() throws Exception {
ZKUtil.deleteRecursive(zk.getZookeeperClient().getZooKeeper(), "/resa");
}