Java 类org.apache.hadoop.hbase.client.backoff.ClientBackoffPolicyFactory 实例源码

项目:ditb    文件:ConnectionManager.java   
/**
 * For tests.
 */
protected HConnectionImplementation(Configuration conf) {
  this.conf = conf;
  this.connectionConfig = new ConnectionConfiguration(conf);
  this.closed = false;
  this.pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE,
      HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
  this.useMetaReplicas = conf.getBoolean(HConstants.USE_META_REPLICAS,
      HConstants.DEFAULT_USE_META_REPLICAS);
  this.numTries = connectionConfig.getRetriesNumber();
  this.rpcTimeout = conf.getInt(
      HConstants.HBASE_RPC_TIMEOUT_KEY,
      HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
  if (conf.getBoolean(CLIENT_NONCES_ENABLED_KEY, true)) {
    synchronized (nonceGeneratorCreateLock) {
      if (ConnectionManager.nonceGenerator == null) {
        ConnectionManager.nonceGenerator = new PerClientRandomNonceGenerator();
      }
      this.nonceGenerator = ConnectionManager.nonceGenerator;
    }
  } else {
    this.nonceGenerator = new NoNonceGenerator();
  }
  stats = ServerStatisticTracker.create(conf);
  this.asyncProcess = createAsyncProcess(this.conf);
  this.interceptor = (new RetryingCallerInterceptorFactory(conf)).build();
  this.rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf, interceptor, this.stats);
  this.backoffPolicy = ClientBackoffPolicyFactory.create(conf);
  if (conf.getBoolean(CLIENT_SIDE_METRICS_ENABLED_KEY, false)) {
    this.metrics = new MetricsConnection(this);
  } else {
    this.metrics = null;
  }

  this.hostnamesCanChange = conf.getBoolean(RESOLVE_HOSTNAME_ON_FAIL_KEY, true);
  this.metaCache = new MetaCache(this.metrics);
}
项目:pbase    文件:ConnectionManager.java   
/**
 * For tests.
 */
protected HConnectionImplementation(Configuration conf) {
    this.conf = conf;
    this.tableConfig = new TableConfiguration(conf);//复制缓存配置信息
    this.closed = false;
    this.pause = conf.getLong(HConstants.HBASE_CLIENT_PAUSE,
            HConstants.DEFAULT_HBASE_CLIENT_PAUSE);
    this.numTries = tableConfig.getRetriesNumber();
    this.rpcTimeout = conf.getInt(
            HConstants.HBASE_RPC_TIMEOUT_KEY,
            HConstants.DEFAULT_HBASE_RPC_TIMEOUT);
    if (conf.getBoolean(CLIENT_NONCES_ENABLED_KEY, true)) {//随机数?
        synchronized (nonceGeneratorCreateLock) {
            if (ConnectionManager.nonceGenerator == null) {
                ConnectionManager.nonceGenerator = new PerClientRandomNonceGenerator();//每个客户端随机的NonceGEnerator,主要是为了生成clientid
            }
            this.nonceGenerator = ConnectionManager.nonceGenerator;
        }
    } else {
        this.nonceGenerator = new NoNonceGenerator();
    }
    stats = ServerStatisticTracker.create(conf);
    this.asyncProcess = createAsyncProcess(this.conf);
    this.interceptor = (new RetryingCallerInterceptorFactory(conf)).build();
    this.rpcCallerFactory = RpcRetryingCallerFactory.instantiate(conf, interceptor, this.stats);
    this.backoffPolicy = ClientBackoffPolicyFactory.create(conf);
}