- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkMapStore
类的一些代码示例,展示了ZkMapStore
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkMapStore
类的具体详情如下:
包路径:com.bazaarvoice.emodb.common.zookeeper.store.ZkMapStore
类名称:ZkMapStore
[英]Stores a Map in ZooKeeper, watches for changes made by other servers, and caches values locally for fast access. Uses NodeDiscovery to cache values.
[中]在ZooKeeper中存储地图,监视其他服务器所做的更改,并在本地缓存值以便快速访问。使用NodeDiscovery缓存值。
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Override
public void start() throws Exception {
// Create the ZooKeeper node (persistent, not ephemeral)
createNode(_zkPath);
_nodeDiscovery.start();
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
private String getKeyFromPath(String path) {
return decodeKey(ZKPaths.getNodeFromPath(path));
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Override
public void set(String key, T value) throws Exception {
if (getAll().containsKey(key)) {
_curator.setData().forPath(toPath(key), toZkBytes(value));
} else {
_curator.create().forPath(toPath(key), toZkBytes(value));
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor
@Provides @Singleton @MinSplitSizeMap
MapStore<DataStoreMinSplitSize> provideMinSplitSizeMap(@DataStoreZooKeeper CuratorFramework curator,
LifeCycleRegistry lifeCycle) {
return lifeCycle.manage(new ZkMapStore<>(curator, "min-split-size", new ZKDataStoreMinSplitSizeSerializer()));
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Nullable
@Override
public T get(String key) {
return _nodeDiscovery.getNodes().get(toPath(key));
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Override
public Map<String, T> getAll() {
// Return an immutable copy since users should only be able to modify the map using set and remove.
ImmutableMap.Builder<String, T> builder = ImmutableMap.builder();
for (Map.Entry<String, T> entry : _nodeDiscovery.getNodes().entrySet()) {
builder.put(getKeyFromPath(entry.getKey()), entry.getValue());
}
return builder.build();
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
private String toPath(String key) {
checkArgument(key.indexOf('/') == -1, "Keys may not contain '/'.");
// The key may contain special characters which are invalid in ZooKeeper paths. Encode them
String encodedKey = encodeKey(key);
String path = ZKPaths.makePath(_zkPath, encodedKey);
PathUtils.validatePath(path);
return path;
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Override
public String toString() {
return Maps.transformValues(getAll(), new Function<T, Object>() {
@Override
public Object apply(T value) {
return _serializer.toString(value);
}
}).toString();
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
private String encodeKey(String key) {
StringBuilder encodedKey = null;
int lastEncodedCharPos = -1;
int length = key.length();
for (int i=0; i < length; i++) {
char c = key.charAt(i);
if (c == '.' // May be interpreted as relative path
|| c == '%' // Collides with encoding scheme
|| isUnsupportedCharacter(c)) {
if (lastEncodedCharPos == -1) {
// This is the first character that has been encoded
encodedKey = new StringBuilder();
}
encodedKey.append(key.substring(lastEncodedCharPos + 1, i));
encodedKey.append("%").append(String.format("%04x", (int) c));
lastEncodedCharPos = i;
}
}
if (lastEncodedCharPos == -1) {
return key;
}
encodedKey.append(key.substring(lastEncodedCharPos+1));
return encodedKey.toString();
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-sor
@Provides @Singleton @Maintenance
MapStore<Double> provideRateLimiterSettings(@DataStoreZooKeeper CuratorFramework curator,
LifeCycleRegistry lifeCycle) {
return lifeCycle.manage(new ZkMapStore<>(curator, "background_table_maintenance-rate-limits", new ZkDoubleSerializer()));
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Override
public void remove(String key) throws Exception {
try {
_curator.delete().forPath(toPath(key));
} catch (KeeperException.NoNodeException e) {
// Don't care
}
}
代码示例来源:origin: com.bazaarvoice.emodb/emodb-common-zookeeper
@Override
public Set<String> keySet() {
ImmutableSet.Builder<String> builder = ImmutableSet.builder();
for (String key : _nodeDiscovery.getNodes().keySet()) {
builder.add(getKeyFromPath(key));
}
return builder.build();
}
代码示例来源:origin: bazaarvoice/emodb
private String toPath(String key) {
checkArgument(key.indexOf('/') == -1, "Keys may not contain '/'.");
// The key may contain special characters which are invalid in ZooKeeper paths. Encode them
String encodedKey = encodeKey(key);
String path = ZKPaths.makePath(_zkPath, encodedKey);
PathUtils.validatePath(path);
return path;
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public String toString() {
return Maps.transformValues(getAll(), new Function<T, Object>() {
@Override
public Object apply(T value) {
return _serializer.toString(value);
}
}).toString();
}
}
代码示例来源:origin: bazaarvoice/emodb
private String encodeKey(String key) {
StringBuilder encodedKey = null;
int lastEncodedCharPos = -1;
int length = key.length();
for (int i=0; i < length; i++) {
char c = key.charAt(i);
if (c == '.' // May be interpreted as relative path
|| c == '%' // Collides with encoding scheme
|| isUnsupportedCharacter(c)) {
if (lastEncodedCharPos == -1) {
// This is the first character that has been encoded
encodedKey = new StringBuilder();
}
encodedKey.append(key.substring(lastEncodedCharPos + 1, i));
encodedKey.append("%").append(String.format("%04x", (int) c));
lastEncodedCharPos = i;
}
}
if (lastEncodedCharPos == -1) {
return key;
}
encodedKey.append(key.substring(lastEncodedCharPos+1));
return encodedKey.toString();
}
代码示例来源:origin: bazaarvoice/emodb
@Provides @Singleton @MinSplitSizeMap
MapStore<DataStoreMinSplitSize> provideMinSplitSizeMap(@DataStoreZooKeeper CuratorFramework curator,
LifeCycleRegistry lifeCycle) {
return lifeCycle.manage(new ZkMapStore<>(curator, "min-split-size", new ZKDataStoreMinSplitSizeSerializer()));
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public void set(String key, T value) throws Exception {
if (getAll().containsKey(key)) {
_curator.setData().forPath(toPath(key), toZkBytes(value));
} else {
_curator.create().forPath(toPath(key), toZkBytes(value));
}
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public void remove(String key) throws Exception {
try {
_curator.delete().forPath(toPath(key));
} catch (KeeperException.NoNodeException e) {
// Don't care
}
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public Map<String, T> getAll() {
// Return an immutable copy since users should only be able to modify the map using set and remove.
ImmutableMap.Builder<String, T> builder = ImmutableMap.builder();
for (Map.Entry<String, T> entry : _nodeDiscovery.getNodes().entrySet()) {
builder.put(getKeyFromPath(entry.getKey()), entry.getValue());
}
return builder.build();
}
代码示例来源:origin: bazaarvoice/emodb
@Override
public void start() throws Exception {
// Create the ZooKeeper node (persistent, not ephemeral)
createNode(_zkPath);
_nodeDiscovery.start();
}
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkTimestampSerializer类的一些代码示例,展示了ZkTimestampS
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkMapStore类的一些代码示例,展示了ZkMapStore类的具体用法。这些代码示例
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkDurationSerializer类的一些代码示例,展示了ZkDurationSer
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkBooleanSerializer类的一些代码示例,展示了ZkBooleanSeria
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkValueStore类的一些代码示例,展示了ZkValueStore类的具体用法。这些
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkValueSerializer类的一些代码示例,展示了ZkValueSerialize
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkMapStore.()方法的一些代码示例,展示了ZkMapStore.()的具体用法。
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkTimestampSerializer.()方法的一些代码示例,展示了ZkTimest
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkTimestampSerializer.fromString()方法的一些代码示例,展
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkDurationSerializer.()方法的一些代码示例,展示了ZkDuratio
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkBooleanSerializer.()方法的一些代码示例,展示了ZkBooleanS
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkValueStore.()方法的一些代码示例,展示了ZkValueStore.()的具
本文整理了Java中com.bazaarvoice.emodb.common.zookeeper.store.ZkValueSerializer.fromString()方法的一些代码示例,展示了Zk
我是一名优秀的程序员,十分优秀!