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


Java TreeCache.close方法代码示例

本文整理汇总了Java中org.apache.curator.framework.recipes.cache.TreeCache.close方法的典型用法代码示例。如果您正苦于以下问题:Java TreeCache.close方法的具体用法?Java TreeCache.close怎么用?Java TreeCache.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.curator.framework.recipes.cache.TreeCache的用法示例。


在下文中一共展示了TreeCache.close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evictCacheData

import org.apache.curator.framework.recipes.cache.TreeCache; //导入方法依赖的package包/类
@Override
public void evictCacheData(final String cachePath) {
	TreeCache cache = caches.remove(cachePath + "/");
	if (null != cache) {
		cache.close();
	}
}
 
开发者ID:imadcn,项目名称:idworker,代码行数:8,代码来源:ZookeeperRegistryCenter.java

示例2: evictCacheData

import org.apache.curator.framework.recipes.cache.TreeCache; //导入方法依赖的package包/类
@Override
public void evictCacheData(final String cachePath) {
    TreeCache cache = caches.remove(cachePath + "/");
    if (null != cache) {
        cache.close();
    }
}
 
开发者ID:elasticjob,项目名称:elastic-job-cloud,代码行数:8,代码来源:ZookeeperRegistryCenter.java

示例3: main

import org.apache.curator.framework.recipes.cache.TreeCache; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
    // Connect to zk
    try (
            CuratorFramework client = CuratorFrameworkFactory.newClient(zookeeprUrls, new ExponentialBackoffRetry(1000, 3));) {

        client.start();
        System.err.println("CuratorFramework start....");
        // Register watcher
        TreeCache treeCache = new TreeCache(client, BasePath);
        treeCache.getListenable().addListener((curatorClient, treeCacheEvent) -> {
            ChildData childData = treeCacheEvent.getData();
            if (childData == null) {
                System.err.println("No data in event" + treeCacheEvent);
            } else {
                System.err.println("Receive event:"
                        + "type:" + treeCacheEvent.getType()
                        + ", path:" + childData.getPath()
                        + ", data:" + String.valueOf(childData.getData())
                        + ", stat:" + childData.getStat());
            }
        });

        treeCache.start();
        System.err.println("tree cache start..");

        TimeUnit.MINUTES.sleep(5);
        treeCache.close();

    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
开发者ID:sdcuike,项目名称:book-reading,代码行数:34,代码来源:CuratorWatcher2.java

示例4: close

import org.apache.curator.framework.recipes.cache.TreeCache; //导入方法依赖的package包/类
@Override
public void close() {
	if (this.running.compareAndSet(true, false)) {
		for (TreeCache cache : this.caches.values()) {
			cache.close();
		}
		this.caches = null;
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-zookeeper,代码行数:10,代码来源:ConfigWatcher.java


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