use of org.apache.curator.RetryPolicy in project drill by apache.
the class TestZookeeperClient method setUp.
@Before
public void setUp() throws Exception {
server = new TestingServer();
final RetryPolicy policy = new RetryNTimes(1, 1000);
curator = CuratorFrameworkFactory.newClient(server.getConnectString(), policy);
client = new ClientWithMockCache(curator, root, mode);
server.start();
curator.start();
client.start();
}
use of org.apache.curator.RetryPolicy in project lucene-solr by apache.
the class HadoopAuthFilter method getCuratorClient.
protected CuratorFramework getCuratorClient(SolrZkClient zkClient) {
// should we try to build a RetryPolicy off of the ZkController?
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
if (zkClient == null) {
throw new IllegalArgumentException("zkClient required");
}
String zkHost = zkClient.getZkServerAddress();
String zkChroot = zkHost.contains("/") ? zkHost.substring(zkHost.indexOf("/")) : "";
String zkNamespace = zkChroot + SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH;
zkNamespace = zkNamespace.startsWith("/") ? zkNamespace.substring(1) : zkNamespace;
String zkConnectionString = zkHost.contains("/") ? zkHost.substring(0, zkHost.indexOf("/")) : zkHost;
SolrZkToCuratorCredentialsACLs curatorToSolrZk = new SolrZkToCuratorCredentialsACLs(zkClient);
// this value is currently hard coded, see SOLR-7561.
final int connectionTimeoutMs = 30000;
curatorFramework = CuratorFrameworkFactory.builder().namespace(zkNamespace).connectString(zkConnectionString).retryPolicy(retryPolicy).aclProvider(curatorToSolrZk.getACLProvider()).authorization(curatorToSolrZk.getAuthInfos()).sessionTimeoutMs(zkClient.getZkClientTimeout()).connectionTimeoutMs(connectionTimeoutMs).build();
curatorFramework.start();
return curatorFramework;
}
use of org.apache.curator.RetryPolicy in project lucene-solr by apache.
the class DelegationTokenKerberosFilter method getCuratorClient.
protected CuratorFramework getCuratorClient(SolrZkClient zkClient) {
// should we try to build a RetryPolicy off of the ZkController?
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
if (zkClient == null) {
throw new IllegalArgumentException("zkClient required");
}
String zkHost = zkClient.getZkServerAddress();
String zkChroot = zkHost.contains("/") ? zkHost.substring(zkHost.indexOf("/")) : "";
String zkNamespace = zkChroot + SecurityAwareZkACLProvider.SECURITY_ZNODE_PATH;
zkNamespace = zkNamespace.startsWith("/") ? zkNamespace.substring(1) : zkNamespace;
String zkConnectionString = zkHost.contains("/") ? zkHost.substring(0, zkHost.indexOf("/")) : zkHost;
SolrZkToCuratorCredentialsACLs curatorToSolrZk = new SolrZkToCuratorCredentialsACLs(zkClient);
// this value is currently hard coded, see SOLR-7561.
final int connectionTimeoutMs = 30000;
curatorFramework = CuratorFrameworkFactory.builder().namespace(zkNamespace).connectString(zkConnectionString).retryPolicy(retryPolicy).aclProvider(curatorToSolrZk.getACLProvider()).authorization(curatorToSolrZk.getAuthInfos()).sessionTimeoutMs(zkClient.getZkClientTimeout()).connectionTimeoutMs(connectionTimeoutMs).build();
curatorFramework.start();
return curatorFramework;
}
use of org.apache.curator.RetryPolicy in project metron by apache.
the class TestConfig method client.
@Bean(initMethod = "start", destroyMethod = "close")
public CuratorFramework client(ComponentRunner componentRunner) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
ZKServerComponent zkServerComponent = componentRunner.getComponent("zk", ZKServerComponent.class);
return CuratorFrameworkFactory.newClient(zkServerComponent.getConnectionString(), retryPolicy);
}
use of org.apache.curator.RetryPolicy in project metron by apache.
the class ProfileBuilderBolt method setupZookeeper.
private void setupZookeeper() {
try {
if (zookeeperClient == null) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
zookeeperClient = CuratorFrameworkFactory.newClient(zookeeperUrl, retryPolicy);
}
zookeeperClient.start();
// this is temporary to ensure that any validation passes. the individual bolt
// will reinitialize stellar to dynamically pull from zookeeper.
ConfigurationsUtils.setupStellarStatically(zookeeperClient);
if (zookeeperCache == null) {
ConfigurationsUpdater<ProfilerConfigurations> updater = createUpdater();
SimpleEventListener listener = new SimpleEventListener.Builder().with(updater::update, TreeCacheEvent.Type.NODE_ADDED, TreeCacheEvent.Type.NODE_UPDATED).with(updater::delete, TreeCacheEvent.Type.NODE_REMOVED).build();
zookeeperCache = new ZKCache.Builder().withClient(zookeeperClient).withListener(listener).withRoot(Constants.ZOOKEEPER_TOPOLOGY_ROOT).build();
updater.forceUpdate(zookeeperClient);
zookeeperCache.start();
}
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throw new RuntimeException(e);
}
}
Aggregations