org.apache.curator.framework.imps.GzipCompressionProvider Java Examples
The following examples show how to use
org.apache.curator.framework.imps.GzipCompressionProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CuratorServiceImpl.java From titus-control-plane with Apache License 2.0 | 6 votes |
@Inject public CuratorServiceImpl(ZookeeperConfiguration configs, ZookeeperClusterResolver clusterResolver, Registry registry) { isConnectedGauge = PolledMeter.using(registry).withName("titusMaster.curator.isConnected").monitorValue(new AtomicInteger()); Optional<String> connectString = clusterResolver.resolve(); if (!connectString.isPresent()) { // Fail early if connection to zookeeper not defined LOG.error("Zookeeper connectivity details not found"); throw new IllegalStateException("Zookeeper connectivity details not found"); } curator = CuratorFrameworkFactory.builder() .compressionProvider(new GzipCompressionProvider()) .connectionTimeoutMs(configs.getZkConnectionTimeoutMs()) .retryPolicy(new ExponentialBackoffRetry(configs.getZkConnectionRetrySleepMs(), configs.getZkConnectionMaxRetries())) .connectString(connectString.get()) .build(); }
Example #2
Source File: Resources.java From DCMonitor with MIT License | 6 votes |
public static void init() throws Exception { try { Config.CuratorConfig zkConfig = Config.config.zookeeper; curator = CuratorFrameworkFactory .builder() .connectString(zkConfig.addrs) .retryPolicy(new ExponentialBackoffRetry(zkConfig.baseSleepTimeMs, zkConfig.maxRetries, zkConfig.maxSleepMs)) .compressionProvider(new GzipCompressionProvider()) .build(); curator.start(); kafkaInfos = new KafkaInfos(new ZkClient(zkConfig.addrs, 30000, zkConfig.connectionTimeout, zkSerializer)); druidInfos = Config.config.druidInfos; zkHosts = new ZookeeperHosts(Config.config.zookeeper.addrs); druidInfos.init(); notify = new Notify(Config.config.notify.url); fetchers = Config.config.fetchers; Prometheus.defaultInitialize(); prometheusQuery = new PrometheusQuery(Config.config.prometheus.serverUrl); } catch (Exception e) { log.error(e, "error while initialyzing resourses"); throw e; } }