- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中io.fabric8.zookeeper.utils.ZooKeeperUtils.delete()
方法的一些代码示例,展示了ZooKeeperUtils.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperUtils.delete()
方法的具体详情如下:
包路径:io.fabric8.zookeeper.utils.ZooKeeperUtils
类名称:ZooKeeperUtils
方法名:delete
[英]Deletes a path and (when there are no other children) also parent path - up to given parent
[中]删除一个路径,并且(当没有其他子路径时)还删除父路径,直到给定的父路径
代码示例来源:origin: jboss-fuse/fabric8
protected void unExportService(final ServiceReference reference) {
try {
ExportRegistration registration = exportedServices.remove(reference);
if (registration != null) {
server.unregisterService(registration.getExportedEndpoint().getId());
delete(curator, registration.getZooKeeperNode());
}
} catch (Exception e) {
LOGGER.info("Error when unexporting endpoint", e);
}
}
代码示例来源:origin: jboss-fuse/fabric8
/**
* Unregister a webapp from the registry.
* @param container
* @param webEvent
*/
private void unRegisterWebapp(Container container, WebEvent webEvent) {
try {
String name = webEvent.getBundle().getSymbolicName();
clearJolokiaUrl(container, name);
webEvents.remove(webEvent.getBundle());
delete(curator.get(), ZkPath.WEBAPPS_CONTAINER.getPath(name, webEvent.getBundle().getVersion().toString(), container.getId()));
} catch (KeeperException.NoNodeException e) {
// If the node does not exists, ignore the exception
} catch (Exception e) {
LOGGER.error("Failed to unregister webapp {}.", webEvent.getContextPath(), e);
}
}
代码示例来源:origin: jboss-fuse/fabric8
private void unregisterServlet(Container container, ServletEvent servletEvent) {
try {
String bundleName = servletEvent.getBundle().getSymbolicName();
String bundleVersion = servletEvent.getBundle().getVersion().toString();
clearJolokiaUrl(container, bundleName);
Map<String, ServletEvent> events = servletEvents.get(servletEvent.getBundle());
if (events != null) {
events.remove(servletEvent.getAlias());
}
String id = container.getId();
//We don't want to register / it's fabric-redirect for hawtio
if (!servletEvent.getAlias().equals("/")) {
String path = createServletPath(servletEvent, id, bundleName, bundleVersion);
delete(curator.get(), path);
}
} catch (KeeperException.NoNodeException e) {
// If the node does not exists, ignore the exception
} catch (Exception e) {
LOGGER.error("Failed to unregister servlet {}.", servletEvent.getAlias(), e);
}
}
代码示例来源:origin: jboss-fuse/fabric8
private void updateProcessId() {
try {
// TODO: this is Sun JVM specific ...
//String processName = (String) mbeanServer.get().getAttribute(new ObjectName("java.lang:type=Runtime"), "Name");
String processName = ManagementFactory.getRuntimeMXBean().getName();
Long processId = Long.parseLong(processName.split("@")[0]);
String runtimeIdentity = runtimeProperties.get().getRuntimeIdentity();
String path = ZkPath.CONTAINER_PROCESS_ID.getPath(runtimeIdentity);
Stat stat = exists(curator.get(), path);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
delete(curator.get(), path);
if( processId!=null ) {
create(curator.get(), path, processId.toString(), CreateMode.EPHEMERAL);
}
}
} else {
if( processId!=null ) {
create(curator.get(), path, processId.toString(), CreateMode.EPHEMERAL);
}
}
} catch (IllegalStateException e){
handleException(e);
} catch (Exception ex) {
LOGGER.error("Error while updating the process id.", ex);
}
}
代码示例来源:origin: io.fabric8/fabric-extender-listener
@Override
public void run() {
if (isValid()) {
String extender = getExtenderType();
try {
if (bundleStatus != null) {
setData(getCurator(), ZkPath.CONTAINER_EXTENDER_BUNDLE.getPath(runtimeIdentity, extender, String.valueOf(bundleId)),
bundleStatus.name(), CreateMode.EPHEMERAL);
} else {
delete(getCurator(), ZkPath.CONTAINER_EXTENDER_BUNDLE.getPath(runtimeIdentity, extender, String.valueOf(bundleId)));
}
setData(getCurator(), ZkPath.CONTAINER_EXTENDER_STATUS.getPath(runtimeIdentity, extender),
extenderStatus.name(), CreateMode.EPHEMERAL);
} catch (Exception e) {
LOGGER.debug("Failed to update status of bundle {} for extender {}.", bundleId, extender);
}
}
}
});
代码示例来源:origin: jboss-fuse/fabric8
@Override
public void run() {
if (isValid()) {
String extender = getExtenderType();
try {
if (bundleStatus != null) {
setData(getCurator(), ZkPath.CONTAINER_EXTENDER_BUNDLE.getPath(runtimeIdentity, extender, String.valueOf(bundleId)),
bundleStatus.name(), CreateMode.EPHEMERAL);
} else {
delete(getCurator(), ZkPath.CONTAINER_EXTENDER_BUNDLE.getPath(runtimeIdentity, extender, String.valueOf(bundleId)));
}
setData(getCurator(), ZkPath.CONTAINER_EXTENDER_STATUS.getPath(runtimeIdentity, extender),
extenderStatus.name(), CreateMode.EPHEMERAL);
} catch (Exception e) {
LOGGER.debug("Failed to update status of bundle {} for extender {}.", bundleId, extender);
}
}
}
});
代码示例来源:origin: jboss-fuse/fabric8
private void zkCleanUp(Group<GitNode> group) {
try {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
curator.get().newNamespaceAwareEnsurePath(ZkPath.GIT.getPath()).ensure(curator.get().getZookeeperClient());
List<String> allChildren = ZooKeeperUtils.getAllChildren(curator.get(), ZkPath.GIT.getPath());
for (String path : allChildren) {
String stringData = ZooKeeperUtils.getStringData(curator.get(), path);
if (stringData.contains("\"container\":\"" + runtimeIdentity + "\"")) {
LOGGER.info("Found older ZK \"/fabric/registry/clusters/git\" entry for node " + runtimeIdentity);
ZooKeeperUtils.delete(curator.get(), path);
LOGGER.info("Older ZK \"/fabric/registry/clusters/git\" entry for node " + runtimeIdentity + " has been removed");
}
}
} catch (KeeperException.NoNodeException ignored) {
} catch (Exception e) {
handleException( e);
}
}
代码示例来源:origin: io.fabric8.runtime/fabric-runtime-container-wildfly-registration
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
Stat stat = ZooKeeperUtils.exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
ZooKeeperUtils.delete(curator.get(), nodeAlive);
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
代码示例来源:origin: io.fabric8.runtime/fabric-runtime-container-tomcat-registration
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
Stat stat = ZooKeeperUtils.exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
ZooKeeperUtils.delete(curator.get(), nodeAlive);
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
代码示例来源:origin: jboss-fuse/fabric8
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
Stat stat = exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
delete(curator.get(), nodeAlive);
create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
代码示例来源:origin: io.fabric8.runtime/fabric-runtime-container-karaf-registration
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
Stat stat = exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
delete(curator.get(), nodeAlive);
create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
代码示例来源:origin: io.fabric8.runtime/embedded
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String karafName = sysprops.getProperty(SystemProperties.KARAF_NAME);
String nodeAlive = CONTAINER_ALIVE.getPath(karafName);
Stat stat = ZooKeeperUtils.exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
ZooKeeperUtils.delete(curator.get(), nodeAlive);
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
代码示例来源:origin: io.fabric8.runtime/fabric-runtime-embedded
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
Stat stat = ZooKeeperUtils.exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
ZooKeeperUtils.delete(curator.get(), nodeAlive);
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
代码示例来源:origin: io.fabric8.runtime/fabric8-runtime-container-tomcat-registration
private void checkAlive() throws Exception {
RuntimeProperties sysprops = runtimeProperties.get();
String runtimeIdentity = sysprops.getRuntimeIdentity();
String nodeAlive = CONTAINER_ALIVE.getPath(runtimeIdentity);
Stat stat = ZooKeeperUtils.exists(curator.get(), nodeAlive);
if (stat != null) {
if (stat.getEphemeralOwner() != curator.get().getZookeeperClient().getZooKeeper().getSessionId()) {
ZooKeeperUtils.delete(curator.get(), nodeAlive);
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
} else {
ZooKeeperUtils.create(curator.get(), nodeAlive, CreateMode.EPHEMERAL);
}
}
我写了这个课: class StaticList { private: int headFree; int headList; int locNe
我目前正在使用 SQL Server Management Studio 2005,我遇到了一些问题,但首先是我的 DB 架构的摘录(重要的): imghack link to the image 我
范围:两个表。创建新顾客时,他们会将一些有关他们的信息存储到第二个表中(这也是使用触发器完成的,它按预期工作)。这是我的表结构和关系的示例。 表 1-> 赞助人 +-----+---------+--
我想知道,在整个程序中,我使用了很多指向 cstrings 的 char* 指针,以及其他指针。我想确保在程序完成后删除所有指针,即使 Visual Studio 和 Code Blocks 都为我做
考虑以下代码: class Foo { Monster* monsters[6]; Foo() { for (int i = 0; i < 6; i++)
关于 this page , 是这么写的 One reason is that the operand of delete need not be an lvalue. Consider: delet
我无法在 DELETE CASCADE ON UPDATE CASCADE 上添加外键约束。 我使用两个简单的表格。 TAB1 有 2 列:ID int(10) unsigned NOT NULL A
你好,有没有办法把它放在一个声明中? DELETE e_worklist where wbs_element = '00000000000000000054TTO'. DELETE e_workli
我有一个表,它是我系统的核心,向我的客户显示的所有结果都存储在那里。它增长得非常快,因此每 3 小时我应该删除早于 X 的记录以提高性能。 仅删除这些记录就足够了,还是应该在删除后运行优化表? 我正在
这个问题在这里已经有了答案: delete vs delete[] operators in C++ (7 个答案) 关闭 9 年前。 做和做有什么区别: int* I = new int[100]
为什么这段代码是错误的?我是否遗漏了有关 delete 和 delete[] 行为的内容? void remove_stopwords(char** strings, int* length) {
当我使用 new [] 申请内存时。最后,我使用 delete 来释放内存(不是 delete[])。会不会造成内存泄漏? 两种类型: 内置类型,如 int、char、double ... 我不确定。
所以在代码审查期间,我的一位同事使用了 double* d = new double[foo]; 然后调用了 delete d。我告诉他们应该将其更改为 delete [] d。他们说编译器不需要基本
范围:两个表。当一个新顾客被创建时,他们将一些关于他们的信息存储到第二个表中(这也是使用触发器完成的,它按预期工作)。这是我的表结构和关系的示例。 表 1-> 赞助人 +-----+---------
C++14 介绍 "sized" versions of operator delete ,即 void operator delete( void* ptr, std::size_t sz ); 和
我正在执行类似的语句 DELETE FROM USER WHERE USER_ID=1; 在 SQLDeveloper 中。 由于用户在许多表中被引用(例如用户有订单、设置等),我们激活了 ON DE
出于某种原因,我找不到我需要的确切答案。我在这里搜索了最后 20 分钟。 我知道这很简单。很简单。但由于某种原因我无法触发触发器.. 我有一个包含两列的表格 dbo.HashTags |__Id_|_
这是我的代码: #include #include #include int main() { setvbuf(stdout, NULL, _IONBF, 0); setvbuf
是否可以在 postgres 中使用单个命令删除所有表中的所有行(不破坏数据库),或者在 postgres 中级联删除? 如果没有,那么我该如何重置我的测试数据库? 最佳答案 is it possib
我想删除一些临时文件的内容,所以我正在开发一个小程序来帮我删除它们。我有这两个代码示例,但我对以下内容感到困惑: 哪个代码示例更好? 第一个示例 code1 删除文件 1 和 2,但第二个示例 cod
我是一名优秀的程序员,十分优秀!