当前位置: 首页>>代码示例>>Java>>正文


Java ZKUtil.deleteRecursive方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:21,代码来源:BKLogWriteHandler.java

示例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;
    }
}
 
开发者ID:hhu-bsinfo,项目名称:dxram,代码行数:22,代码来源:ZooKeeperHandler.java

示例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;
}
 
开发者ID:sereca,项目名称:SecureKeeper,代码行数:10,代码来源:DeleteAllCommand.java

示例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);
    }
}
 
开发者ID:twitter,项目名称:distributedlog,代码行数:33,代码来源:BKDistributedLogManager.java

示例5: deleteZkNode

import org.apache.zookeeper.ZKUtil; //导入方法依赖的package包/类
@Test
public void deleteZkNode() throws Exception {
    ZKUtil.deleteRecursive(zk.getZookeeperClient().getZooKeeper(), "/resa");
}
 
开发者ID:ADSC-Resa,项目名称:resa,代码行数:5,代码来源:MigrateSimulateForCH.java


注:本文中的org.apache.zookeeper.ZKUtil.deleteRecursive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。