- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.eudemon.ratelimiter.env.ZookeeperConfig
类的一些代码示例,展示了ZookeeperConfig
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperConfig
类的具体详情如下:
包路径:com.eudemon.ratelimiter.env.ZookeeperConfig
类名称:ZookeeperConfig
[英]Zookeeper configuration.
[中]Zookeeper配置。
代码示例来源:origin: wangzheng0822/ratelimiter4j
public void testBuildFromProperties_withEmptyProperties() {
PropertySource propertySource = new PropertySource();
ZookeeperConfig zkConfig = new ZookeeperConfig();
zkConfig.buildFromProperties(propertySource);
assertTrue(StringUtils.isEmpty(zkConfig.getAddress()));
assertEquals(zkConfig.getPath(), ZookeeperConfig.DEFAULT_PATH);
}
代码示例来源:origin: wangzheng0822/ratelimiter4j
public MemoryUrlRateLimiter build() {
RuleConfigParser parser = null;
if (this.ruleParserType.equals("yaml")) {
parser = new YamlRuleConfigParser();
} else if (this.ruleParserType.equals("json")) {
parser = new JsonRuleConfigParser();
} else {
throw new RuntimeException("Do not support the rule paser type: " + this.ruleParserType);
}
RuleConfigSource source = null;
if (this.ruleSourceType.equals("file")) {
source = new FileRuleConfigSource();
} else if (this.ruleSourceType.equals("zookeeper")) {
if (zookeeperConfig != null && StringUtils.isNoneBlank(zookeeperConfig.getAddress())
&& StringUtils.isNoneBlank(zookeeperConfig.getPath())) {
source = new ZookeeperRuleConfigSource(zookeeperConfig.getAddress(),
zookeeperConfig.getPath(), parser);
} else {
throw new RuntimeException("some zookeeper configuration is empty.");
}
} else {
throw new RuntimeException("Do not support the rule source type: " + this.ruleSourceType);
}
MemoryUrlRateLimiter ratelimiter = new MemoryUrlRateLimiter(source);
if (this.interceptors != null && !this.interceptors.isEmpty()) {
ratelimiter.addInteceptors(interceptors);
}
return ratelimiter;
}
代码示例来源:origin: wangzheng0822/ratelimiter4j
private void mapPropertiesToConfigs(PropertySource propertySource) {
String parserType =
propertySource.getPropertyStringValue(PropertyConstants.PROPERTY_RULE_CONFIG_PARSER);
if (StringUtils.isNotBlank(parserType)) {
this.ruleConfigParserType = parserType;
}
String source =
propertySource.getPropertyStringValue(PropertyConstants.PROPERTY_RULE_CONFIG_SOURCE);
if (StringUtils.isNotBlank(source)) {
this.ruleConfigSourceType = source;
}
redisConfig.buildFromProperties(propertySource);
zookeeperConfig.buildFromProperties(propertySource);
}
代码示例来源:origin: wangzheng0822/ratelimiter4j
@BeforeClass
public void setup() {
System.setProperty(PropertyConstants.PROPERTY_REDIS_ADDRESS, REDIS_IP_PORT);
System.setProperty(PropertyConstants.PROPERTY_REDIS_TIMEOUT, String.valueOf(REDIS_TIMEOUT));
System.setProperty(PropertyConstants.PROPERTY_ZOOKEEPER_ADDRESS, ZK_ADDR);
System.setProperty(PropertyConstants.PROPERTY_ZOOKEEPER_RULE_PATH, ZK_PATH);
redisConfig.setAddress(REDIS_IP_PORT);
redisConfig.setTimeout(REDIS_TIMEOUT);
zookeeperConfig.setAddress(ZK_ADDR);
zookeeperConfig.setPath(ZK_PATH);
}
代码示例来源:origin: wangzheng0822/ratelimiter4j
public ZookeeperRuleConfigSource(String address, String path, RuleConfigParser ruleConfigParser) {
RateLimiterConfig.instance().load();
if (StringUtils.isEmpty(address)) {
address = RateLimiterConfig.instance().getZookeeperConfig().getAddress();
}
if (StringUtils.isEmpty(path)) {
path = RateLimiterConfig.instance().getZookeeperConfig().getPath();
}
this.address = address;
this.path = path;
this.ruleConfigParser = BEANS_CONTEXT.obtainRuleConfigParser(ruleConfigParser);
}
代码示例来源:origin: wangzheng0822/ratelimiter4j
public void testBuildFromProperties() {
PropertySource propertySource = new PropertySource();
Map<String, Object> properties = new LinkedHashMap<>();
properties.put(PropertyConstants.PROPERTY_ZOOKEEPER_ADDRESS, "1.1.1.1:1212");
properties.put(PropertyConstants.PROPERTY_ZOOKEEPER_RULE_PATH, "/com/eudemon/ratelimit");
propertySource.addProperties(properties);
ZookeeperConfig zkConfig = new ZookeeperConfig();
zkConfig.buildFromProperties(propertySource);
assertEquals(zkConfig.getAddress(), "1.1.1.1:1212");
assertEquals(zkConfig.getPath(), "/com/eudemon/ratelimit");
}
代码示例来源:origin: wangzheng0822/ratelimiter4j
source = new FileRuleConfigSource();
} else if (this.ruleSourceType.equals("zookeeper")) {
if (zookeeperConfig != null && StringUtils.isNoneBlank(zookeeperConfig.getAddress())
&& StringUtils.isNoneBlank(zookeeperConfig.getPath())) {
source = new ZookeeperRuleConfigSource(zookeeperConfig.getAddress(),
zookeeperConfig.getPath(), parser);
} else {
throw new RuntimeException("some zookeeper configuration is empty.");
本文整理了Java中com.palominolabs.benchpress.config.ZookeeperConfig.getWorkerServiceName()方法的一些代码示例,展示了Zook
本文整理了Java中com.palominolabs.benchpress.config.ZookeeperConfig.getBasePath()方法的一些代码示例,展示了ZookeeperConf
本文整理了Java中com.eudemon.ratelimiter.env.ZookeeperConfig.getPath()方法的一些代码示例,展示了ZookeeperConfig.getPath(
本文整理了Java中org.apache.giraph.zk.ZookeeperConfig.setClientPortAddress()方法的一些代码示例,展示了ZookeeperConfig.se
本文整理了Java中org.apache.giraph.zk.ZookeeperConfig.setDataDir()方法的一些代码示例,展示了ZookeeperConfig.setDataDir()
本文整理了Java中org.apache.giraph.zk.ZookeeperConfig.setMinSessionTimeout()方法的一些代码示例,展示了ZookeeperConfig.se
本文整理了Java中org.apache.giraph.zk.ZookeeperConfig.()方法的一些代码示例,展示了ZookeeperConfig.()的具体用法。这些代码示例主要来源于Git
我是一名优秀的程序员,十分优秀!