作者热门文章
- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.uber.marmaray.common.configuration.ZookeeperConfiguration.<init>()
方法的一些代码示例,展示了ZookeeperConfiguration.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperConfiguration.<init>()
方法的具体详情如下:
包路径:com.uber.marmaray.common.configuration.ZookeeperConfiguration
类名称:ZookeeperConfiguration
方法名:<init>
暂无
代码示例来源:origin: uber/marmaray
public LockManager(@NonNull final Configuration conf) {
this.lockConf = new LockManagerConfiguration(conf);
this.isEnabled = lockConf.isEnabled();
this.lockMap = new ConcurrentHashMap();
if (this.isEnabled) {
final ZookeeperConfiguration zkConf = new ZookeeperConfiguration(conf);
this.client = Optional.of(CuratorFrameworkFactory.builder()
.connectString(zkConf.getZkQuorum())
.retryPolicy(new BoundedExponentialBackoffRetry(1000, 5000, 3))
.namespace(lockConf.getZkBasePath())
.sessionTimeoutMs(lockConf.getZkSessionTimeoutMs())
.connectionTimeoutMs(lockConf.getZkConnectionTimeoutMs())
.build());
this.client.get().start();
} else {
this.client = Optional.absent();
}
}
代码示例来源:origin: uber/marmaray
@Test
public void testLockInfo() throws Exception {
final String LOCK_INFO = "This is the information in the lock";
final String key1 = LockManager.getLockKey("test_lock", "key1");
try (final LockManager lockManager = new LockManager(conf)) {
assertTrue(lockManager.lock(key1, LOCK_INFO));
final LockManagerConfiguration lockConf = new LockManagerConfiguration(conf);
final ZookeeperConfiguration zkConf = new ZookeeperConfiguration(conf);
final CuratorFramework client = CuratorFrameworkFactory.builder()
.connectString(zkConf.getZkQuorum())
.retryPolicy(new BoundedExponentialBackoffRetry(1000, 5000, 3))
.namespace(lockConf.getZkBasePath())
.sessionTimeoutMs(lockConf.getZkSessionTimeoutMs())
.connectionTimeoutMs(lockConf.getZkConnectionTimeoutMs())
.build();
client.start();
final String node = client.getChildren().forPath(key1).get(0);
final String data = new String(client.getData().forPath(key1 + "/" + node));
assertEquals(LOCK_INFO, data);
client.close();
lockManager.unlock(key1);
}
}
本文整理了Java中com.uber.marmaray.common.configuration.ZookeeperConfiguration类的一些代码示例,展示了ZookeeperConfigur
本文整理了Java中com.uber.marmaray.common.configuration.ZookeeperConfiguration.getZkQuorum()方法的一些代码示例,展示了Zo
本文整理了Java中com.uber.marmaray.common.configuration.ZookeeperConfiguration.()方法的一些代码示例,展示了ZookeeperConf
我是一名优秀的程序员,十分优秀!