本文整理了Java中org.apache.twill.zookeeper.ZKClient.delete()
方法的一些代码示例,展示了ZKClient.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKClient.delete()
方法的具体详情如下:
包路径:org.apache.twill.zookeeper.ZKClient
类名称:ZKClient
方法名:delete
[英]Deletes the node of the given path without matching version. Same as calling #delete(String,int).
[中]删除给定路径的节点,但不匹配版本。与调用#delete(String,int)相同。
代码示例来源:origin: org.apache.twill/twill-core
@Override
public void run() {
logIfFailed(zkClient.delete(path, version));
}
};
代码示例来源:origin: apache/twill
@Override
public void run() {
logIfFailed(zkClient.delete(path, version));
}
};
代码示例来源:origin: org.apache.twill/twill-zookeeper
@Override
public OperationFuture<String> delete(String deletePath, int version) {
return delegate.delete(deletePath, version);
}
代码示例来源:origin: org.apache.twill/twill-zookeeper
@Override
public OperationFuture<String> delete(String deletePath, int version) {
return client.delete(deletePath, version);
}
代码示例来源:origin: apache/twill
@Override
public OperationFuture<String> delete(String deletePath, int version) {
return client.delete(deletePath, version);
}
代码示例来源:origin: apache/twill
@Override
public OperationFuture<String> delete(String deletePath, int version) {
return delegate.delete(deletePath, version);
}
代码示例来源:origin: org.apache.twill/twill-zookeeper
@Override
public void run() {
try {
future.get();
} catch (Exception e) {
zkClient.delete(node);
}
}
}, Threads.SAME_THREAD_EXECUTOR);
代码示例来源:origin: caskdata/cdap
/**
* Removes the {@link ResourceAssignment} with the given name from local cache as well as ZK.
* @param name Name of the resource.
*/
private void removeAssignment(String name) {
assignments.remove(name);
String zkPath = CoordinationConstants.ASSIGNMENTS_PATH + "/" + name;
// Simply delete the assignment node. No need to care about the result.
// Even if failed to delete the node and leaves stale assignment, next time when an assignment action is
// triggered, it'll correct it.
zkClient.delete(zkPath);
}
代码示例来源:origin: co.cask.cdap/cdap-common
/**
* Removes the {@link ResourceAssignment} with the given name from local cache as well as ZK.
* @param name Name of the resource.
*/
private void removeAssignment(String name) {
assignments.remove(name);
String zkPath = CoordinationConstants.ASSIGNMENTS_PATH + "/" + name;
// Simply delete the assignment node. No need to care about the result.
// Even if failed to delete the node and leaves stale assignment, next time when an assignment action is
// triggered, it'll correct it.
zkClient.delete(zkPath);
}
代码示例来源:origin: apache/twill
@Override
public void run() {
try {
future.get();
} catch (Exception e) {
zkClient.delete(node);
}
}
}, Threads.SAME_THREAD_EXECUTOR);
代码示例来源:origin: caskdata/coopr
@Override
public void run() {
try {
future.get();
} catch (Exception e) {
zkClient.delete(node);
}
}
}, Threads.SAME_THREAD_EXECUTOR);
代码示例来源:origin: caskdata/coopr
/**
* Acts as {@link ZKClient#delete(String)} if passed {@code ignoreIfAbsent} param is false.
* Otherwise the same way but doesn't throw exception if node doesn't exists.
* In latter case sets {@code null} in returned future.
*/
public static ListenableFuture<String> delete(final ZKClient zkClient,
final String path,
final int version,
boolean ignoreIfAbsent) {
if (!ignoreIfAbsent) {
return zkClient.delete(path, version);
}
return ignoreError(zkClient.delete(path, version), KeeperException.NoNodeException.class);
}
代码示例来源:origin: caskdata/cdap
/**
* Deletes the {@link ResourceRequirement} for the given resource.
*
* @param resourceName Name of the resource.
* @return A {@link ListenableFuture} that will be completed when the requirement is successfully removed.
* If the requirement doesn't exists, the deletion would still be treated as successful.
*/
public ListenableFuture<String> deleteRequirement(String resourceName) {
String zkPath = CoordinationConstants.REQUIREMENTS_PATH + "/" + resourceName;
return Futures.transform(
ZKOperations.ignoreError(zkClient.delete(zkPath), KeeperException.NoNodeException.class, resourceName),
Functions.constant(resourceName)
);
}
代码示例来源:origin: cdapio/cdap
@Override
public void delete(final ProgramId serviceId) throws NotFoundException {
OperationFuture<String> future = zkClient.delete(getZKPath(serviceId));
SettableFuture<RouteConfig> oldConfigFuture = routeConfigMap.get(serviceId);
try {
future.get(ZK_TIMEOUT_SECS, TimeUnit.SECONDS);
routeConfigMap.remove(serviceId, oldConfigFuture);
} catch (ExecutionException | InterruptedException | TimeoutException ex) {
if (ex.getCause() instanceof KeeperException.NoNodeException) {
throw new NotFoundException(String.format("Route Config for Service %s was not found.", serviceId));
}
throw Throwables.propagate(ex);
}
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
@Override
public void delete(final ProgramId serviceId) throws NotFoundException {
OperationFuture<String> future = zkClient.delete(getZKPath(serviceId));
SettableFuture<RouteConfig> oldConfigFuture = routeConfigMap.get(serviceId);
try {
future.get(ZK_TIMEOUT_SECS, TimeUnit.SECONDS);
routeConfigMap.remove(serviceId, oldConfigFuture);
} catch (ExecutionException | InterruptedException | TimeoutException ex) {
if (ex.getCause() instanceof KeeperException.NoNodeException) {
throw new NotFoundException(String.format("Route Config for Service %s was not found.", serviceId));
}
throw Throwables.propagate(ex);
}
}
代码示例来源:origin: co.cask.cdap/cdap-common
/**
* Deletes the {@link ResourceRequirement} for the given resource.
*
* @param resourceName Name of the resource.
* @return A {@link ListenableFuture} that will be completed when the requirement is successfully removed.
* If the requirement doesn't exists, the deletion would still be treated as successful.
*/
public ListenableFuture<String> deleteRequirement(String resourceName) {
String zkPath = CoordinationConstants.REQUIREMENTS_PATH + "/" + resourceName;
return Futures.transform(
ZKOperations.ignoreError(zkClient.delete(zkPath), KeeperException.NoNodeException.class, resourceName),
Functions.constant(resourceName)
);
}
代码示例来源:origin: org.apache.twill/twill-core
private OperationFuture<String> removeLiveNode() {
String liveNode = getLiveNodePath();
LOG.info("Remove live node {}{}", zkClient.getConnectString(), liveNode);
return ZKOperations.ignoreError(zkClient.delete(liveNode), KeeperException.NoNodeException.class, liveNode);
}
代码示例来源:origin: apache/twill
private OperationFuture<String> removeLiveNode() {
String liveNode = getLiveNodePath();
LOG.info("Remove live node {}{}", zkClient.getConnectString(), liveNode);
return ZKOperations.ignoreError(zkClient.delete(liveNode), KeeperException.NoNodeException.class, liveNode);
}
代码示例来源:origin: apache/twill
@Override
public OperationFuture<String> delete(String deletePath, int version) {
return relayPath(delegate.delete(getNamespacedPath(deletePath), version), this.<String>createFuture(deletePath));
}
代码示例来源:origin: org.apache.twill/twill-zookeeper
@Override
public OperationFuture<String> delete(String deletePath, int version) {
return relayPath(delegate.delete(getNamespacedPath(deletePath), version), this.<String>createFuture(deletePath));
}
内容来源于网络,如有侵权,请联系作者删除!