예제 #1
0
  protected static void setupBuilder(
      CuratorFrameworkFactory.Builder builder, String zkStr, Map conf, ZookeeperAuthInfo auth) {
    builder
        .connectString(zkStr)
        .connectionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT)))
        .sessionTimeoutMs(Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT)))
        .retryPolicy(
            new StormBoundedExponentialBackoffRetry(
                Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL)),
                Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL_CEILING)),
                Utils.getInt(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES))));

    if (auth != null && auth.scheme != null && auth.payload != null) {
      builder = builder.authorization(auth.scheme, auth.payload);
    }
  }