- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中co.cask.cdap.common.zookeeper.ZKExtOperations
类的一些代码示例,展示了ZKExtOperations
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKExtOperations
类的具体详情如下:
包路径:co.cask.cdap.common.zookeeper.ZKExtOperations
类名称:ZKExtOperations
[英]Collection of common zk operations. NOTE: When this class is matured, we could move this into twill ZKOperations.
[中]常见zk操作的集合。注意:当这个类成熟时,我们可以将其转移到twill操作中。
代码示例来源: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
/**
* Attempts to create a persistent node with the given content. If creation failed because the node already
* exists ({@link KeeperException.NodeExistsException}), the node will be set with the given content.
* This method is suitable for cases where the node expected to be non-existed.
*
* @param zkClient The ZKClient to perform the operations.
* @param path The path in ZK.
* @param dataSupplier The supplier to provide the content to be set to the node. The supplier may get invoked
* multiple times when the actual data is needed for creating or setting the content of
* the given node. The supplier can be invoked from the caller thread as well as the
* zookeeper event callback thread.
* @param codec A {@link Codec} for serializing the data into byte array.
* @param maxFailure Maximum number of times to try to create/set the content.
* @param acls The access control list to set on the node, if it is created.
* @param <T> Type of the data.
* @return A {@link ListenableFuture} that will be completed when node is created or data is set. The future will
* fail if failed to create and to set the data. Calling {@link ListenableFuture#cancel(boolean)} has
* no effect.
*/
public static <T> ListenableFuture<T> createOrSet(ZKClient zkClient, String path, Supplier<T> dataSupplier,
Codec<T> codec, int maxFailure, List<ACL> acls) {
return createOrSetWithRetry(true, zkClient, path, dataSupplier, codec, acls, maxFailure);
}
代码示例来源:origin: caskdata/cdap
/**
* Submits the given {@link ResourceRequirement} for allocation.
*
* @param requirement The requirement to be submitted.
* @return A {@link ListenableFuture} that will be completed when submission is completed and it'll carry the
* submitted requirement as result. The future will fail if failed to submit the requirement. Calling
* {@link ListenableFuture#cancel(boolean)} has no effect.
*/
public ListenableFuture<ResourceRequirement> submitRequirement(ResourceRequirement requirement) {
String zkPath = CoordinationConstants.REQUIREMENTS_PATH + "/" + requirement.getName();
return ZKExtOperations.createOrSet(zkClient, zkPath, Suppliers.ofInstance(requirement),
CoordinationConstants.RESOURCE_REQUIREMENT_CODEC,
CoordinationConstants.MAX_ZK_FAILURE_RETRY);
}
代码示例来源: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: co.cask.cdap/cdap-common
final Codec<T> codec, @Nullable final Iterable<ACL> acls) {
final SettableFuture<T> resultFuture = SettableFuture.create();
final Supplier<ListenableFuture<T>> futureSupplier = createFutureSupplier(dataSupplier);
try {
? create(zkClient, path, futureSupplier, codec, acls, SettableFuture.<T>create())
: setData(zkClient, path, dataSupplier, codec, SettableFuture.<T>create());
代码示例来源:origin: caskdata/cdap
doCreateOrSet(createFirst, zkClient, path, dataSupplier, codec, acls),
new FutureCallback<T>() {
@Override
代码示例来源:origin: caskdata/cdap
ListenableFuture<V> createFuture = create(zkClient, path, new Supplier<ListenableFuture<V>>() {
@Override
public ListenableFuture<V> get() {
代码示例来源:origin: co.cask.cdap/cdap-common
/**
* Submits the given {@link ResourceRequirement} for allocation.
*
* @param requirement The requirement to be submitted.
* @return A {@link ListenableFuture} that will be completed when submission is completed and it'll carry the
* submitted requirement as result. The future will fail if failed to submit the requirement. Calling
* {@link ListenableFuture#cancel(boolean)} has no effect.
*/
public ListenableFuture<ResourceRequirement> submitRequirement(ResourceRequirement requirement) {
String zkPath = CoordinationConstants.REQUIREMENTS_PATH + "/" + requirement.getName();
return ZKExtOperations.createOrSet(zkClient, zkPath, Suppliers.ofInstance(requirement),
CoordinationConstants.RESOURCE_REQUIREMENT_CODEC,
CoordinationConstants.MAX_ZK_FAILURE_RETRY);
}
代码示例来源: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: caskdata/cdap
final Codec<T> codec, @Nullable final Iterable<ACL> acls) {
final SettableFuture<T> resultFuture = SettableFuture.create();
final Supplier<ListenableFuture<T>> futureSupplier = createFutureSupplier(dataSupplier);
try {
? create(zkClient, path, futureSupplier, codec, acls, SettableFuture.<T>create())
: setData(zkClient, path, dataSupplier, codec, SettableFuture.<T>create());
代码示例来源:origin: co.cask.cdap/cdap-common
doCreateOrSet(createFirst, zkClient, path, dataSupplier, codec, acls),
new FutureCallback<T>() {
@Override
代码示例来源:origin: co.cask.cdap/cdap-common
ListenableFuture<V> createFuture = create(zkClient, path, new Supplier<ListenableFuture<V>>() {
@Override
public ListenableFuture<V> get() {
代码示例来源:origin: cdapio/cdap
@Override
public void store(final ProgramId serviceId, final RouteConfig routeConfig) {
Supplier<RouteConfig> supplier = Suppliers.ofInstance(routeConfig);
SettableFuture<RouteConfig> oldConfigFuture = routeConfigMap.get(serviceId);
Future<RouteConfig> future = ZKExtOperations.createOrSet(zkClient, getZKPath(serviceId), supplier,
ROUTE_CONFIG_CODEC, 10);
try {
future.get(ZK_TIMEOUT_SECS, TimeUnit.SECONDS);
SettableFuture<RouteConfig> newFuture = SettableFuture.create();
newFuture.set(routeConfig);
if (oldConfigFuture != null) {
routeConfigMap.replace(serviceId, oldConfigFuture, newFuture);
} else {
routeConfigMap.putIfAbsent(serviceId, newFuture);
}
} catch (ExecutionException | InterruptedException | TimeoutException ex) {
throw Throwables.propagate(ex);
}
}
代码示例来源: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
Suppliers.ofInstance(assignmentName));
Futures.addCallback(
ZKExtOperations.setOrCreate(zkClient, zkPath, dataSupplier, CoordinationConstants.RESOURCE_ASSIGNMENT_CODEC,
CoordinationConstants.MAX_ZK_FAILURE_RETRY),
new FutureCallback<ResourceAssignment>() {
代码示例来源:origin: co.cask.cdap/cdap-common
/**
* Attempts to create a persistent node with the given content. If creation failed because the node already
* exists ({@link KeeperException.NodeExistsException}), the node will be set with the given content.
* This method is suitable for cases where the node expected to be non-existed.
*
* @param zkClient The ZKClient to perform the operations.
* @param path The path in ZK.
* @param dataSupplier The supplier to provide the content to be set to the node. The supplier may get invoked
* multiple times when the actual data is needed for creating or setting the content of
* the given node. The supplier can be invoked from the caller thread as well as the
* zookeeper event callback thread.
* @param codec A {@link Codec} for serializing the data into byte array.
* @param maxFailure Maximum number of times to try to create/set the content.
* @param <T> Type of the data.
* @return A {@link ListenableFuture} that will be completed when node is created or data is set. The future will
* fail if failed to create and to set the data. Calling {@link ListenableFuture#cancel(boolean)} has
* no effect.
*/
public static <T> ListenableFuture<T> createOrSet(ZKClient zkClient, String path, Supplier<T> dataSupplier,
Codec<T> codec, int maxFailure) {
return createOrSetWithRetry(true, zkClient, path, dataSupplier, codec, null, maxFailure);
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
@Override
public void store(final ProgramId serviceId, final RouteConfig routeConfig) {
Supplier<RouteConfig> supplier = Suppliers.ofInstance(routeConfig);
SettableFuture<RouteConfig> oldConfigFuture = routeConfigMap.get(serviceId);
Future<RouteConfig> future = ZKExtOperations.createOrSet(zkClient, getZKPath(serviceId), supplier,
ROUTE_CONFIG_CODEC, 10);
try {
future.get(ZK_TIMEOUT_SECS, TimeUnit.SECONDS);
SettableFuture<RouteConfig> newFuture = SettableFuture.create();
newFuture.set(routeConfig);
if (oldConfigFuture != null) {
routeConfigMap.replace(serviceId, oldConfigFuture, newFuture);
} else {
routeConfigMap.putIfAbsent(serviceId, newFuture);
}
} catch (ExecutionException | InterruptedException | TimeoutException ex) {
throw Throwables.propagate(ex);
}
}
代码示例来源: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
Suppliers.ofInstance(assignmentName));
Futures.addCallback(
ZKExtOperations.setOrCreate(zkClient, zkPath, dataSupplier, CoordinationConstants.RESOURCE_ASSIGNMENT_CODEC,
CoordinationConstants.MAX_ZK_FAILURE_RETRY),
new FutureCallback<ResourceAssignment>() {
代码示例来源:origin: caskdata/cdap
/**
* Attempts to create a persistent node with the given content. If creation failed because the node already
* exists ({@link KeeperException.NodeExistsException}), the node will be set with the given content.
* This method is suitable for cases where the node expected to be non-existed.
*
* @param zkClient The ZKClient to perform the operations.
* @param path The path in ZK.
* @param dataSupplier The supplier to provide the content to be set to the node. The supplier may get invoked
* multiple times when the actual data is needed for creating or setting the content of
* the given node. The supplier can be invoked from the caller thread as well as the
* zookeeper event callback thread.
* @param codec A {@link Codec} for serializing the data into byte array.
* @param maxFailure Maximum number of times to try to create/set the content.
* @param acls The access control list to set on the node, if it is created.
* @param <T> Type of the data.
* @return A {@link ListenableFuture} that will be completed when node is created or data is set. The future will
* fail if failed to create and to set the data. Calling {@link ListenableFuture#cancel(boolean)} has
* no effect.
*/
public static <T> ListenableFuture<T> createOrSet(ZKClient zkClient, String path, Supplier<T> dataSupplier,
Codec<T> codec, int maxFailure, List<ACL> acls) {
return createOrSetWithRetry(true, zkClient, path, dataSupplier, codec, acls, maxFailure);
}
由于其中一个项目使用的是 Java 1.7,我希望该版本能够手动运行 mrunit 测试用例。我在我的机器上安装了 java8,还想要 java7。当我运行 brew cask install jav
我刚刚安装了一个新的 Cask,然后运行了 brew doctor,它返回了 Error: Cask 'java' is unreadable: undefined method undent' fo
我正在尝试使用brew-cask安装virtual box,但这会返回这种错误,并且我无法安装virtualbox。我使用 MacOSX Lion 10.7.5 和 homebrew 0.9.5,ru
最近更新 cask 时,我开始出现以下错误: Error: Cask 'java' definition is invalid: Token '{:v1=>"java"}' in header lin
如何使用 ansible 安装特定版本的自制 cask 配方?例如,vagrant 2.2.6 而最新可用的是 2.2.7。 最佳答案 使用较新版本的 Homebrew cask命令已被删除并导致错误
我按照 http://caskroom.io/ 中的描述安装了 Homebrew Cask 用于踢球.它归结为以下命令: $ brew install caskroom/cask/brew-cask
本文整理了Java中co.cask.tephra.runtime.ZKModule类的一些代码示例,展示了ZKModule类的具体用法。这些代码示例主要来源于Github/Stackoverflow/
本文整理了Java中co.cask.tigon.guice.ZKClientModule类的一些代码示例,展示了ZKClientModule类的具体用法。这些代码示例主要来源于Github/Stack
我使用 brew cask 安装了信号(brew cask install signal) 我希望能够通过键入 signal 从终端启动 GUI 应用程序(例如:要运行 emacs 的 GUI [使用
我最近安装了 homebrew-cask,我看到的一件事是它默认将应用程序安装到以下目录中: 版本包下载 => /opt/homebrew-cask/Caskroom/ 示例:/opt/homebre
我想知道我的哪些应用程序可以使用 brew cask 安装命令。 我该怎么做? 规范 我想要做的是从 /Applications 中的所有应用程序中提取 brew-cask 上也可用的应用程序并列出他
我安装了一个 Homebrew 桶,当我尝试卸载它时,它给了我一个错误: $ brew cask uninstall julia Error: Cask 'julia' definition is i
我使用Homebrew Cask在 OS X 上安装应用程序。如何升级所有已安装的 casks? 最佳答案 现在 Homebrew Cask 终于有了官方升级机制(具体实现请参见Issue 3396)
嗯,我刚刚更新了我的 brew 并在执行 brew tap phinze/cask 命令后在我的机器上安装了 brew-cask 公式。然后我用brew cask install vagrant来安装
哪个目录是brew cask install使用的真实位置? 我想找到应用程序的真实位置,而不是/Application中的符号链接(symbolic link) 最佳答案 您可以在可用的 Casks
本文整理了Java中co.cask.cdap.api.workflow.WorkflowToken类的一些代码示例,展示了WorkflowToken类的具体用法。这些代码示例主要来源于Github/S
本文整理了Java中co.cask.cdap.api.workflow.WorkflowSpecification类的一些代码示例,展示了WorkflowSpecification类的具体用法。这些代
本文整理了Java中co.cask.cdap.common.guice.ZKClientModule类的一些代码示例,展示了ZKClientModule类的具体用法。这些代码示例主要来源于Github
本文整理了Java中co.cask.cdap.common.guice.ZKDiscoveryModule类的一些代码示例,展示了ZKDiscoveryModule类的具体用法。这些代码示例主要来源于
本文整理了Java中co.cask.cdap.common.zookeeper.ZKExtOperations类的一些代码示例,展示了ZKExtOperations类的具体用法。这些代码示例主要来源于
我是一名优秀的程序员,十分优秀!