本文整理了Java中co.cask.cdap.common.zookeeper.store.ZKPropertyStore
类的一些代码示例,展示了ZKPropertyStore
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKPropertyStore
类的具体详情如下:
包路径:co.cask.cdap.common.zookeeper.store.ZKPropertyStore
类名称:ZKPropertyStore
[英]This class uses ZK for storing properties/configures. It provides update methods for updating properties, and listener methods for watching for changes in properties. TODO: Unify this and SharedResourceCache in security module.
[中]此类使用ZK存储属性/配置。它提供了更新属性的更新方法,以及监视属性更改的侦听器方法。TODO:在安全模块中统一此和SharedResourceCache。
代码示例来源:origin: co.cask.cdap/cdap-data-fabric
@Override
protected <T> PropertyStore<T> createPropertyStore(Codec<T> codec) {
return ZKPropertyStore.create(zkClient, "/" + Constants.Service.STREAMS + "/properties", codec);
}
代码示例来源:origin: co.cask.cdap/cdap-common
/**
* Creates an instance of {@link ZKPropertyStore}.
*
* @param zkClient client for interacting with ZooKeeper. Nodes will be created at root represented by this ZKClient.
* @param codec The codec for encode/decode property
*/
public static <T> ZKPropertyStore<T> create(ZKClient zkClient, Codec<T> codec) {
return new ZKPropertyStore<>(zkClient, codec);
}
代码示例来源:origin: co.cask.cdap/cdap-common
@Override
protected synchronized boolean listenerAdded(String name) {
if (watchedSet.add(name)) {
// Start watching for node change and maintain cached value.
// Invocation of listener would be triggered inside ZK callback.
existsAndWatch(name);
return false;
}
// Invoke it with the cached property if available when first added.
// If no cache value exists, meaning either property was removed or still pending for update for the first time
// For first case, no need to invoke listener. For second case, when the cache get updated, the newly
// added listener would get triggered
return true;
}
代码示例来源:origin: co.cask.cdap/cdap-common
@Override
public ListenableFuture<T> set(String name, T property) {
return ZKExtOperations.setOrCreate(zkClient, getPath(name), Suppliers.ofInstance(property),
codec, MAX_ZK_FAILURE_RETRIES);
}
代码示例来源:origin: caskdata/cdap
@Override
public ListenableFuture<T> set(String name, T property) {
return ZKExtOperations.setOrCreate(zkClient, getPath(name), Suppliers.ofInstance(property),
codec, MAX_ZK_FAILURE_RETRIES);
}
代码示例来源:origin: co.cask.cdap/cdap-common
@Override
public ListenableFuture<T> update(String name, PropertyUpdater<T> updater) {
return ZKExtOperations.updateOrCreate(zkClient, getPath(name), updater, codec);
}
代码示例来源:origin: cdapio/cdap
@Override
protected <T> PropertyStore<T> createPropertyStore(Codec<T> codec) {
return ZKPropertyStore.create(zkClient, codec);
}
}
代码示例来源:origin: caskdata/cdap
/**
* Creates an instance of {@link ZKPropertyStore}.
*
* @param zkClient client for interacting with ZooKeeper. Nodes will be created at root represented by this ZKClient.
* @param codec The codec for encode/decode property
*/
public static <T> ZKPropertyStore<T> create(ZKClient zkClient, Codec<T> codec) {
return new ZKPropertyStore<>(zkClient, codec);
}
代码示例来源:origin: caskdata/cdap
@Override
protected synchronized boolean listenerAdded(String name) {
if (watchedSet.add(name)) {
// Start watching for node change and maintain cached value.
// Invocation of listener would be triggered inside ZK callback.
existsAndWatch(name);
return false;
}
// Invoke it with the cached property if available when first added.
// If no cache value exists, meaning either property was removed or still pending for update for the first time
// For first case, no need to invoke listener. For second case, when the cache get updated, the newly
// added listener would get triggered
return true;
}
代码示例来源:origin: caskdata/cdap
@Override
public ListenableFuture<T> update(String name, PropertyUpdater<T> updater) {
return ZKExtOperations.updateOrCreate(zkClient, getPath(name), updater, codec);
}
代码示例来源:origin: caskdata/cdap
/**
* Creates an instance of {@link ZKPropertyStore} with nodes created under the given namespace.
*
* @param zkClient client for interacting with ZooKeeper
* @param namespace Namespace for zk nodes to reside in
* @param codec The codec for encode/decode property
*/
public static <T> ZKPropertyStore<T> create(ZKClient zkClient, String namespace, Codec<T> codec) {
return new ZKPropertyStore<>(ZKClients.namespace(zkClient, namespace), codec);
}
代码示例来源:origin: caskdata/cdap
private void existsAndWatch(final String name) {
Futures.addCallback(zkClient.exists(getPath(name), new Watcher() {
@Override
public void process(WatchedEvent event) {
代码示例来源:origin: co.cask.cdap/cdap-common
/**
* Creates an instance of {@link ZKPropertyStore} with nodes created under the given namespace.
*
* @param zkClient client for interacting with ZooKeeper
* @param namespace Namespace for zk nodes to reside in
* @param codec The codec for encode/decode property
*/
public static <T> ZKPropertyStore<T> create(ZKClient zkClient, String namespace, Codec<T> codec) {
return new ZKPropertyStore<>(ZKClients.namespace(zkClient, namespace), codec);
}
代码示例来源:origin: co.cask.cdap/cdap-common
private void existsAndWatch(final String name) {
Futures.addCallback(zkClient.exists(getPath(name), new Watcher() {
@Override
public void process(WatchedEvent event) {
代码示例来源:origin: caskdata/cdap
private void getDataAndWatch(final String name) {
Futures.addCallback(zkClient.getData(getPath(name), new Watcher() {
@Override
public void process(WatchedEvent event) {
代码示例来源:origin: co.cask.cdap/cdap-common
private void getDataAndWatch(final String name) {
Futures.addCallback(zkClient.getData(getPath(name), new Watcher() {
@Override
public void process(WatchedEvent event) {
内容来源于网络,如有侵权,请联系作者删除!