Java 类org.apache.curator.framework.imps.GzipCompressionProvider 实例源码

项目:redirector    文件:AbstractCommonBeans.java   
@Bean
public CuratorFramework curatorFramework() {
    ZKConfig config = config();

    if (config.useZooKeeperWaitTimePolicy()) {
        return new RedirectorCuratorFramework(config);
    }

    CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
            .connectString(config.getZooKeeperConnection())
            .connectionTimeoutMs(config.getZooKeeperConnectionTimeout())
            .sessionTimeoutMs(config.getZooKeeperSessionTimeout())
            .retryPolicy(new RetryNTimes(config.getZooKeeperRetryAttempts(), config.getZooKeeperRetryInterval()))
            .compressionProvider(new GzipCompressionProvider());

    return builder.build();
}
项目:DCMonitor    文件:Resources.java   
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;
  }
}
项目:redirector    文件:DataStoreSupport.java   
private CuratorFramework createCurator(ZKConfig config) {
    CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
        .connectString(config.getZooKeeperConnection())
        .connectionTimeoutMs(config.getZooKeeperConnectionTimeout())
        .sessionTimeoutMs(config.getZooKeeperSessionTimeout())
        .retryPolicy(new RetryNTimes(config.getZooKeeperRetryAttempts(), config.getZooKeeperRetryInterval()));

    builder.compressionProvider(new GzipCompressionProvider());
    return builder.build();
}
项目:redirector    文件:RedirectorCuratorFramework.java   
private synchronized CuratorFramework buildCuratorFramework(final ZKConfig config) {

        CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
                .connectString(config.getZooKeeperConnection())
                .connectionTimeoutMs(config.getZooKeeperConnectionTimeout())
                .sessionTimeoutMs(config.getZooKeeperSessionTimeout())
                .retryPolicy(new RetryNTimes(config.getZooKeeperRetryAttempts(), config.getZooKeeperRetryInterval()))
                .compressionProvider(new GzipCompressionProvider());

        CuratorFramework framework = builder.build();
        listenerStateProxy.updateCurator(framework);
        listenerProxy.updateCurator(framework);
        return framework;
    }