本文整理了Java中org.springframework.integration.zookeeper.metadata.ZookeeperMetadataStore.createNode()
方法的一些代码示例,展示了ZookeeperMetadataStore.createNode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperMetadataStore.createNode()
方法的具体详情如下:
包路径:org.springframework.integration.zookeeper.metadata.ZookeeperMetadataStore
类名称:ZookeeperMetadataStore
方法名:createNode
暂无
代码示例来源:origin: spring-projects/spring-integration
@Override
public void put(String key, String value) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(value, "'value' must not be null.");
synchronized (this.updateMap) {
try {
Stat currentNode = this.client.checkExists().forPath(getPath(key));
if (currentNode == null) {
try {
createNode(key, value);
}
catch (KeeperException.NodeExistsException e) {
updateNode(key, value, -1);
}
}
else {
updateNode(key, value, -1);
}
}
catch (Exception e) {
throw new ZookeeperMetadataStoreException("Error while setting value for key '" + key + "':", e);
}
}
}
代码示例来源:origin: spring-projects/spring-integration
@Override
public String putIfAbsent(String key, String value) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(value, "'value' must not be null.");
synchronized (this.updateMap) {
try {
createNode(key, value);
return null;
}
catch (KeeperException.NodeExistsException e) {
// so the data actually exists, we can read it
try {
byte[] bytes = this.client.getData().forPath(getPath(key));
return IntegrationUtils.bytesToString(bytes, this.encoding);
}
catch (Exception exceptionDuringGet) {
throw new ZookeeperMetadataStoreException("Exception while reading node with key '" + key + "':", e);
}
}
catch (Exception e) {
throw new ZookeeperMetadataStoreException("Error while trying to set '" + key + "':", e);
}
}
}
代码示例来源:origin: org.springframework.integration/spring-integration-zookeeper
@Override
public String putIfAbsent(String key, String value) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(value, "'value' must not be null.");
synchronized (this.updateMap) {
try {
createNode(key, value);
return null;
}
catch (KeeperException.NodeExistsException e) {
// so the data actually exists, we can read it
try {
byte[] bytes = this.client.getData().forPath(getPath(key));
return IntegrationUtils.bytesToString(bytes, this.encoding);
}
catch (Exception exceptionDuringGet) {
throw new ZookeeperMetadataStoreException("Exception while reading node with key '" + key + "':", e);
}
}
catch (Exception e) {
throw new ZookeeperMetadataStoreException("Error while trying to set '" + key + "':", e);
}
}
}
代码示例来源:origin: org.springframework.integration/spring-integration-zookeeper
@Override
public void put(String key, String value) {
Assert.notNull(key, "'key' must not be null.");
Assert.notNull(value, "'value' must not be null.");
synchronized (this.updateMap) {
try {
Stat currentNode = this.client.checkExists().forPath(getPath(key));
if (currentNode == null) {
try {
createNode(key, value);
}
catch (KeeperException.NodeExistsException e) {
updateNode(key, value, -1);
}
}
else {
updateNode(key, value, -1);
}
}
catch (Exception e) {
throw new ZookeeperMetadataStoreException("Error while setting value for key '" + key + "':", e);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!