gpt4 book ai didi

co.cask.cdap.common.zookeeper.ZKExtOperations.updateOrCreate()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 16:51:31 25 4
gpt4 key购买 nike

本文整理了Java中co.cask.cdap.common.zookeeper.ZKExtOperations.updateOrCreate()方法的一些代码示例,展示了ZKExtOperations.updateOrCreate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKExtOperations.updateOrCreate()方法的具体详情如下:
包路径:co.cask.cdap.common.zookeeper.ZKExtOperations
类名称:ZKExtOperations
方法名:updateOrCreate

ZKExtOperations.updateOrCreate介绍

[英]Update the content of the given node. If the node doesn't exist, it will try to create the node. Same as calling #updateOrCreate(ZKClient,String,Function,Codec,List)
[中]更新给定节点的内容。如果节点不存在,它将尝试创建节点。与调用#updateOrCreate(ZKClient、String、Function、Codec、List)相同

代码示例

代码示例来源:origin: caskdata/cdap

/**
 * Update the content of the given node. If the node doesn't exist, it will try to create the node. Same as calling
 *
 * {@link #updateOrCreate(ZKClient, String, AsyncFunction, Codec, List)
 * updateOrCreate(zkClient, path, modifier, codec, null)}
 *
 * @see #updateOrCreate(ZKClient, String, AsyncFunction, Codec, List)
 */
public static <V> ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                           AsyncFunction<V, V> modifier, Codec<V> codec) {
 return updateOrCreate(zkClient, path, modifier, codec, null);
}

代码示例来源:origin: co.cask.cdap/cdap-common

/**
 * Update the content of the given node. If the node doesn't exist, it will try to create the node. Same as calling
 *
 * {@link #updateOrCreate(ZKClient, String, Function, Codec, List)
 * updateOrCreate(zkClient, path, modifier, codec, null)}
 *
 * @see #updateOrCreate(ZKClient, String, Function, Codec, java.util.List)
 */
public static <V> ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                           Function<V, V> modifier, Codec<V> codec) {
 return updateOrCreate(zkClient, path, modifier, codec, null);
}

代码示例来源:origin: co.cask.cdap/cdap-common

/**
 * Update the content of the given node. If the node doesn't exist, it will try to create the node. Same as calling
 *
 * {@link #updateOrCreate(ZKClient, String, AsyncFunction, Codec, List)
 * updateOrCreate(zkClient, path, modifier, codec, null)}
 *
 * @see #updateOrCreate(ZKClient, String, AsyncFunction, Codec, List)
 */
public static <V> ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                           AsyncFunction<V, V> modifier, Codec<V> codec) {
 return updateOrCreate(zkClient, path, modifier, codec, null);
}

代码示例来源:origin: caskdata/cdap

/**
 * Update the content of the given node. If the node doesn't exist, it will try to create the node. Same as calling
 *
 * {@link #updateOrCreate(ZKClient, String, Function, Codec, List)
 * updateOrCreate(zkClient, path, modifier, codec, null)}
 *
 * @see #updateOrCreate(ZKClient, String, Function, Codec, java.util.List)
 */
public static <V> ListenableFuture<V> updateOrCreate(ZKClient zkClient, String path,
                           Function<V, V> modifier, Codec<V> codec) {
 return updateOrCreate(zkClient, path, modifier, codec, null);
}

代码示例来源:origin: caskdata/cdap

/**
 * Modify an existing {@link ResourceRequirement}.
 *
 * @param name Resource name
 * @param modifier A function to modify an existing requirement. The function might get called multiple times
 *                 if there are concurrent modifications from multiple clients.
 * @return A {@link ListenableFuture} that will be completed when submission is completed and it'll carry the
 *         modified requirement as result or {@code null} if the modifier decided not to modify the requirement.
 *         The future will fail if failed to submit the requirement.
 *         Calling {@link ListenableFuture#cancel(boolean)} has no effect.
 */
public ListenableFuture<ResourceRequirement> modifyRequirement(String name, final ResourceModifier modifier) {
 String zkPath = CoordinationConstants.REQUIREMENTS_PATH + "/" + name;
 return ZKExtOperations.updateOrCreate(zkClient, zkPath, modifier, CoordinationConstants.RESOURCE_REQUIREMENT_CODEC);
}

代码示例来源:origin: co.cask.cdap/cdap-common

/**
 * Modify an existing {@link ResourceRequirement}.
 *
 * @param name Resource name
 * @param modifier A function to modify an existing requirement. The function might get called multiple times
 *                 if there are concurrent modifications from multiple clients.
 * @return A {@link ListenableFuture} that will be completed when submission is completed and it'll carry the
 *         modified requirement as result or {@code null} if the modifier decided not to modify the requirement.
 *         The future will fail if failed to submit the requirement.
 *         Calling {@link ListenableFuture#cancel(boolean)} has no effect.
 */
public ListenableFuture<ResourceRequirement> modifyRequirement(String name, final ResourceModifier modifier) {
 String zkPath = CoordinationConstants.REQUIREMENTS_PATH + "/" + name;
 return ZKExtOperations.updateOrCreate(zkClient, zkPath, modifier, CoordinationConstants.RESOURCE_REQUIREMENT_CODEC);
}

代码示例来源:origin: caskdata/cdap

@Override
public ListenableFuture<T> update(String name, PropertyUpdater<T> updater) {
 return ZKExtOperations.updateOrCreate(zkClient, getPath(name), updater, codec);
}

代码示例来源: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

ZKExtOperations.updateOrCreate(zkClient1, path, new Function<Integer, Integer>() {
ZKExtOperations.updateOrCreate(zkClient2, path, new Function<Integer, Integer>() {
Future<Integer> future1 = ZKExtOperations.updateOrCreate(zkClient1, path, modifier, INT_CODEC);
Future<Integer> future2 = ZKExtOperations.updateOrCreate(zkClient2, path, modifier, INT_CODEC);
Integer result = ZKExtOperations.updateOrCreate(zkClient1, path, new Function<Integer, Integer>() {

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com