Search in sources :

Example 6 with RetryPolicy

use of org.apache.bookkeeper.zookeeper.RetryPolicy in project distributedlog by twitter.

the class BKDistributedLogNamespace method createDLZKClientBuilder.

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;
}
Also used : BoundExponentialBackoffRetryPolicy(org.apache.bookkeeper.zookeeper.BoundExponentialBackoffRetryPolicy) RetryPolicy(org.apache.bookkeeper.zookeeper.RetryPolicy) BoundExponentialBackoffRetryPolicy(org.apache.bookkeeper.zookeeper.BoundExponentialBackoffRetryPolicy)

Aggregations

BoundExponentialBackoffRetryPolicy (org.apache.bookkeeper.zookeeper.BoundExponentialBackoffRetryPolicy)6 RetryPolicy (org.apache.bookkeeper.zookeeper.RetryPolicy)6 BookKeeperClient (com.twitter.distributedlog.BookKeeperClient)2 ZooKeeperClient (com.twitter.distributedlog.ZooKeeperClient)2 BKDLConfig (com.twitter.distributedlog.metadata.BKDLConfig)2 ExecutorService (java.util.concurrent.ExecutorService)2 KeeperException (org.apache.zookeeper.KeeperException)2 Credentials (com.twitter.distributedlog.ZooKeeperClient.Credentials)1 DigestCredentials (com.twitter.distributedlog.ZooKeeperClient.DigestCredentials)1 DLInterruptedException (com.twitter.distributedlog.exceptions.DLInterruptedException)1 ZKException (com.twitter.distributedlog.exceptions.ZKException)1 IOException (java.io.IOException)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 WatchedEvent (org.apache.zookeeper.WatchedEvent)1 Watcher (org.apache.zookeeper.Watcher)1 ZooKeeper (org.apache.zookeeper.ZooKeeper)1