本文整理了Java中org.apache.metron.zookeeper.ZKCache.start()
方法的一些代码示例,展示了ZKCache.start()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKCache.start()
方法的具体详情如下:
包路径:org.apache.metron.zookeeper.ZKCache
类名称:ZKCache
方法名:start
[英]Start the cache.
[中]启动缓存。
代码示例来源:origin: apache/metron
private void initializeCache(CuratorFramework client) {
Lock writeLock = lock.writeLock();
try {
writeLock.lock();
SimpleEventListener listener = new SimpleEventListener.Builder()
.with(Iterables.transform(updaters, u -> u::update)
, TreeCacheEvent.Type.NODE_ADDED
, TreeCacheEvent.Type.NODE_UPDATED
)
.with(Iterables.transform(updaters, u -> u::delete)
, TreeCacheEvent.Type.NODE_REMOVED
)
.build();
cache = new ZKCache.Builder()
.withClient(client)
.withListener(listener)
.withRoot(Constants.ZOOKEEPER_TOPOLOGY_ROOT)
.build();
for (ConfigurationsUpdater<? extends Configurations> updater : updaters) {
updater.forceUpdate(client);
}
cache.start();
} catch (Exception e) {
LOG.error("Unable to initialize zookeeper cache: " + e.getMessage(), e);
throw new IllegalStateException("Unable to initialize zookeeper cache: " + e.getMessage(), e);
}
finally {
writeLock.unlock();
}
}
代码示例来源:origin: apache/metron
.build();
updater.forceUpdate(zookeeperClient);
zookeeperCache.start();
代码示例来源:origin: apache/metron
.build();
updater.forceUpdate(client);
cache.start();
内容来源于网络,如有侵权,请联系作者删除!