- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.name()
方法的一些代码示例,展示了ZooKeeperClientBuilder.name()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperClientBuilder.name()
方法的具体详情如下:
包路径:com.twitter.distributedlog.ZooKeeperClientBuilder
类名称:ZooKeeperClientBuilder
方法名:name
[英]Set zookeeper client name
[中]设置zookeeper客户端名称
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testAclPermsZkAccessNoConflict() throws Exception {
String namespace = "/" + runtime.getMethodName();
initDlogMeta(namespace, "test-un", "test-stream");
URI uri = createDLMURI(namespace);
ZooKeeperClient zkc = TestZooKeeperClientBuilder.newBuilder()
.name("unpriv")
.uri(uri)
.build();
zkc.get().getChildren(uri.getPath() + "/test-stream", false, new Stat());
zkc.get().getData(uri.getPath() + "/test-stream", false, new Stat());
}
代码示例来源:origin: twitter/distributedlog
.name("benchmark-zkc")
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.zkAclId(null)
代码示例来源:origin: twitter/distributedlog
Integer.MAX_VALUE);
ZooKeeperClient zkc = ZooKeeperClientBuilder.newBuilder()
.name("DLAuditor-ZK")
.zkServers(zkServers)
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000)
public void testAclPermsZkAccessConflict() throws Exception {
String namespace = "/" + runtime.getMethodName();
initDlogMeta(namespace, "test-un", "test-stream");
URI uri = createDLMURI(namespace);
ZooKeeperClient zkc = TestZooKeeperClientBuilder.newBuilder()
.name("unpriv")
.uri(uri)
.build();
try {
zkc.get().create(uri.getPath() + "/test-stream/test-garbage",
new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
fail("write should have failed due to perms");
} catch (KeeperException.NoAuthException ex) {
LOG.info("caught exception trying to write with no perms", ex);
}
try {
zkc.get().setData(uri.getPath() + "/test-stream", new byte[0], 0);
fail("write should have failed due to perms");
} catch (KeeperException.NoAuthException ex) {
LOG.info("caught exception trying to write with no perms", ex);
}
}
代码示例来源: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
@Before
public void setup() throws Exception {
zkc = TestZooKeeperClientBuilder.newBuilder()
.name("zkc")
.uri(DLMTestUtil.createDLMURI(zkPort, "/"))
.sessionTimeoutMs(sessionTimeoutMs)
.build();
}
代码示例来源:origin: twitter/distributedlog
@Before
public void setup() throws Exception {
zkc = TestZooKeeperClientBuilder.newBuilder()
.name("zkc")
.uri(DLMTestUtil.createDLMURI(zkPort, "/"))
.sessionTimeoutMs(sessionTimeoutMs)
.build();
}
代码示例来源:origin: twitter/distributedlog
Integer.MAX_VALUE);
ZooKeeperClient zkc = ZooKeeperClientBuilder.newBuilder()
.name("DLAuditor-ZK")
.zkServers(zkServers)
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
代码示例来源:origin: twitter/distributedlog
private ZooKeeperClientBuilder clientBuilder(int sessionTimeoutMs)
throws Exception {
return ZooKeeperClientBuilder.newBuilder()
.name("zkc")
.uri(DLMTestUtil.createDLMURI(zkPort, "/"))
.sessionTimeoutMs(sessionTimeoutMs)
.zkServers(zkServers)
.retryPolicy(new BoundExponentialBackoffRetryPolicy(100, 200, 2));
}
代码示例来源:origin: twitter/distributedlog
.name(String.format("dlzk:%s:dlm_writer_shared", name))
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
.name(String.format("dlzk:%s:dlm_reader_shared", name))
.sessionTimeoutMs(conf.getZKSessionTimeoutMilliseconds())
.retryThreadCount(conf.getZKClientNumberRetryThreads())
代码示例来源: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
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
@Before
public void setup() throws Exception {
zkc = ZooKeeperClientBuilder.newBuilder()
.name("zkc")
.uri(createDLMURI("/"))
.sessionTimeoutMs(sessionTimeoutMs)
.zkAclId(null)
.build();
zkc0 = ZooKeeperClientBuilder.newBuilder()
.name("zkc0")
.uri(createDLMURI("/"))
.sessionTimeoutMs(sessionTimeoutMs)
.zkAclId(null)
.build();
lockStateExecutor = OrderedScheduler.newBuilder()
.name("test-scheduer")
.corePoolSize(1)
.build();
}
代码示例来源:origin: twitter/distributedlog
@Before
public void setup() throws Exception {
zkc = ZooKeeperClientBuilder.newBuilder()
.name("zkc")
.uri(DLMTestUtil.createDLMURI(zkPort, "/"))
.sessionTimeoutMs(sessionTimeoutMs)
.zkServers(zkServers)
.zkAclId(null)
.build();
zkc0 = ZooKeeperClientBuilder.newBuilder()
.name("zkc0")
.uri(DLMTestUtil.createDLMURI(zkPort, "/"))
.sessionTimeoutMs(sessionTimeoutMs)
.zkServers(zkServers)
.zkAclId(null)
.build();
lockStateExecutor = OrderedScheduler.newBuilder()
.corePoolSize(1)
.build();
}
代码示例来源:origin: twitter/distributedlog
.name(String.format("dlzk:%s:handler_dedicated", logName))
.uri(uri);
代码示例来源:origin: twitter/distributedlog
@Before
@Override
public void setup() throws Exception {
super.setup();
scheduler = OrderedScheduler.newBuilder().corePoolSize(1).build();
lockStateExecutor = OrderedScheduler.newBuilder().corePoolSize(1).build();
// build zookeeper client
URI uri = createDLMURI("");
zkc = TestZooKeeperClientBuilder.newBuilder(conf)
.name("test-zkc")
.uri(uri)
.build();
zkc0 = TestZooKeeperClientBuilder.newBuilder(conf)
.name("test-zkc0")
.uri(uri)
.build();
// build bookkeeper client
BKDLConfig bkdlConfig = BKDLConfig.resolveDLConfig(zkc, uri);
bkc = BookKeeperClientBuilder.newBuilder()
.dlConfig(conf)
.name("test-bkc")
.ledgersPath(bkdlConfig.getBkLedgersPath())
.zkServers(DLUtils.getZKServersFromDLUri(uri))
.build();
}
代码示例来源:origin: twitter/distributedlog
@Test(timeout = 60000, expected = BKException.ZKException.class)
public void testOpenLedgerWhenZkClosed() throws Exception {
ZooKeeperClient newZkc = TestZooKeeperClientBuilder.newBuilder()
.name("zkc-openledger-when-zk-closed")
.zkServers(zkServers)
.build();
BookKeeperClient newBkc = BookKeeperClientBuilder.newBuilder()
.name("bkc-openledger-when-zk-closed")
.zkc(newZkc)
.ledgersPath(ledgersPath)
.dlConfig(conf)
.build();
try {
LedgerHandle lh = newBkc.get().createLedger(BookKeeper.DigestType.CRC32, "zkcClosed".getBytes(UTF_8));
lh.close();
newZkc.close();
LedgerHandleCache cache =
LedgerHandleCache.newBuilder().bkc(newBkc).conf(conf).build();
// open ledger after zkc closed
cache.openLedger(new LogSegmentMetadata.LogSegmentMetadataBuilder("",
2, lh.getId(), 1).setLogSegmentSequenceNo(lh.getId()).build(), false);
} finally {
newBkc.close();
}
}
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.retryPolicy()方法的一些代码示例,展示了ZooKeeperClien
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.retryThreadCount()方法的一些代码示例,展示了ZooKeeper
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.statsLogger()方法的一些代码示例,展示了ZooKeeperClien
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.zkServers()方法的一些代码示例,展示了ZooKeeperClientB
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.uri()方法的一些代码示例,展示了ZooKeeperClientBuilder
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.build()方法的一些代码示例,展示了ZooKeeperClientBuild
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.name()方法的一些代码示例,展示了ZooKeeperClientBuilde
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.zkAclId()方法的一些代码示例,展示了ZooKeeperClientBui
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.requestRateLimit()方法的一些代码示例,展示了ZooKeeper
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.newBuilder()方法的一些代码示例,展示了ZooKeeperClient
本文整理了Java中com.twitter.distributedlog.ZooKeeperClientBuilder.sessionTimeoutMs()方法的一些代码示例,展示了ZooKeeper
我是一名优秀的程序员,十分优秀!