- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.retryThreadCount()
方法的一些代码示例,展示了ZooKeeperClientBuilder.retryThreadCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperClientBuilder.retryThreadCount()
方法的具体详情如下:
包路径:com.twitter.distributedlog.ZooKeeperClientBuilder
类名称:ZooKeeperClientBuilder
方法名:retryThreadCount
暂无
代码示例来源:origin: twitter/distributedlog
public void create(URI uri) throws IOException {
DistributedLogConfiguration conf = new DistributedLogConfiguration();
ZooKeeperClient zkc = ZooKeeperClientBuilder.newBuilder()
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkAclId(conf.getZkAclId())
.uri(uri)
.build();
byte[] data = serialize();
try {
Utils.zkCreateFullPathOptimistic(zkc, uri.getPath(), data,
zkc.getDefaultACL(), CreateMode.PERSISTENT);
} catch (KeeperException e) {
throw new IOException("Fail to write dl metadata " + new String(data, UTF_8)
+ " to uri " + uri, e);
} catch (InterruptedException e) {
throw new IOException("Interrupted when writing dl metadata " + new String(data, UTF_8)
+ " to uri " + uri, e);
} finally {
zkc.close();
}
}
代码示例来源:origin: twitter/distributedlog
public void update(URI uri) throws IOException {
DistributedLogConfiguration conf = new DistributedLogConfiguration();
ZooKeeperClient zkc = ZooKeeperClientBuilder.newBuilder()
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkAclId(conf.getZkAclId())
.uri(uri)
.build();
byte[] data = serialize();
try {
zkc.get().setData(uri.getPath(), data, -1);
} catch (KeeperException e) {
throw new IOException("Fail to update dl metadata " + new String(data, UTF_8)
+ " to uri " + uri, e);
} catch (InterruptedException e) {
throw new IOException("Interrupted when updating dl metadata "
+ new String(data, UTF_8) + " to uri " + uri, e);
} finally {
zkc.close();
}
}
代码示例来源:origin: twitter/distributedlog
public static void unbind(URI uri) throws IOException {
DistributedLogConfiguration conf = new DistributedLogConfiguration();
ZooKeeperClient zkc = ZooKeeperClientBuilder.newBuilder()
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkAclId(conf.getZkAclId())
.uri(uri)
.build();
byte[] data = new byte[0];
try {
zkc.get().setData(uri.getPath(), data, -1);
} catch (KeeperException ke) {
throw new IOException("Fail to unbound dl metadata on uri " + uri, ke);
} catch (InterruptedException ie) {
throw new IOException("Interrupted when unbinding dl metadata on uri " + uri, ie);
} finally {
zkc.close();
}
}
代码示例来源:origin: twitter/distributedlog
/**
* Run given <i>handler</i> by providing an available new zookeeper client
*
* @param handler
* Handler to process with provided zookeeper client.
* @param conf
* Distributedlog Configuration.
* @param namespace
* Distributedlog Namespace.
*/
private static <T> T withZooKeeperClient(ZooKeeperClientHandler<T> handler,
DistributedLogConfiguration conf,
URI namespace) throws IOException {
ZooKeeperClient zkc = ZooKeeperClientBuilder.newBuilder()
.name(String.format("dlzk:%s:factory_static", namespace))
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.uri(namespace)
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkAclId(conf.getZkAclId())
.build();
try {
return handler.handle(zkc);
} finally {
zkc.close();
}
}
代码示例来源:origin: twitter/distributedlog
.name(String.format("dlzk:%s:dlm_writer_shared", name))
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkAclId(conf.getZkAclId())
.name(String.format("dlzk:%s:dlm_reader_shared", name))
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkServers(zkServersForReader)
代码示例来源:origin: twitter/distributedlog
private static ZooKeeperClientBuilder createBKZKClientBuilder(String zkcName,
DistributedLogConfiguration conf,
String zkServers,
StatsLogger statsLogger) {
RetryPolicy retryPolicy = null;
if (conf.getZKNumRetries() > 0) {
retryPolicy = new BoundExponentialBackoffRetryPolicy(
conf.getBKClientZKRetryBackoffStartMillis(),
conf.getBKClientZKRetryBackoffMaxMillis(),
conf.getBKClientZKNumRetries());
}
ZooKeeperClientBuilder builder = ZooKeeperClientBuilder.newBuilder()
.name(zkcName)
.sessionTimeoutMs(conf.getBKClientZKSessionTimeoutMilliSeconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getBKClientZKRequestRateLimit())
.zkServers(zkServers)
.retryPolicy(retryPolicy)
.statsLogger(statsLogger)
.zkAclId(conf.getZkAclId());
LOG.info("Created shared zooKeeper client builder {}: zkServers = {}, numRetries = {}, sessionTimeout = {}, retryBackoff = {},"
+ " maxRetryBackoff = {}, zkAclId = {}.", new Object[] { zkcName, zkServers, conf.getBKClientZKNumRetries(),
conf.getBKClientZKSessionTimeoutMilliSeconds(), conf.getBKClientZKRetryBackoffStartMillis(),
conf.getBKClientZKRetryBackoffMaxMillis(), conf.getZkAclId() });
return builder;
}
代码示例来源:origin: twitter/distributedlog
private static ZooKeeperClientBuilder createDLZKClientBuilder(String zkcName,
DistributedLogConfiguration conf,
String zkServers,
StatsLogger statsLogger) {
RetryPolicy retryPolicy = null;
if (conf.getZKNumRetries() > 0) {
retryPolicy = new BoundExponentialBackoffRetryPolicy(
conf.getZKRetryBackoffStartMillis(),
conf.getZKRetryBackoffMaxMillis(), conf.getZKNumRetries());
}
ZooKeeperClientBuilder builder = ZooKeeperClientBuilder.newBuilder()
.name(zkcName)
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.zkServers(zkServers)
.retryPolicy(retryPolicy)
.statsLogger(statsLogger)
.zkAclId(conf.getZkAclId());
LOG.info("Created shared zooKeeper client builder {}: zkServers = {}, numRetries = {}, sessionTimeout = {}, retryBackoff = {},"
+ " maxRetryBackoff = {}, zkAclId = {}.", new Object[] { zkcName, zkServers, conf.getZKNumRetries(),
conf.getZKSessionTimeoutMilliseconds(), conf.getZKRetryBackoffStartMillis(),
conf.getZKRetryBackoffMaxMillis(), conf.getZkAclId() });
return builder;
}
代码示例来源:origin: twitter/distributedlog
/**
* Create a zookeeper client builder with provided <i>conf</i> for testing.
*
* @param conf distributedlog configuration
* @return zookeeper client builder
*/
public static ZooKeeperClientBuilder newBuilder(DistributedLogConfiguration conf) {
return ZooKeeperClientBuilder.newBuilder()
.retryPolicy(RetryPolicyUtils.DEFAULT_INFINITE_RETRY_POLICY)
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.zkAclId(conf.getZkAclId())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.requestRateLimit(conf.getZKRequestRateLimit())
.statsLogger(NullStatsLogger.INSTANCE);
}
}
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.retryThreadCount()方法的一些代码示例,展示了ZooKeeper
我是一名优秀的程序员,十分优秀!