Java Code Examples for org.apache.hadoop.hbase.HBaseConfiguration.getInt()

The following are Jave code examples for showing how to use getInt() of the org.apache.hadoop.hbase.HBaseConfiguration class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: ditb   File: ClientScanner.java   Source Code and License Vote up 4 votes
/**
 * Create a new ClientScanner for the specified table Note that the passed {@link Scan}'s start
 * row maybe changed changed.
 * @param conf The {@link Configuration} to use.
 * @param scan {@link Scan} to use in this scanner
 * @param tableName The table that we wish to scan
 * @param connection Connection identifying the cluster
 * @throws IOException
 */
public ClientScanner(final Configuration conf, final Scan scan, final TableName tableName,
    ClusterConnection connection, RpcRetryingCallerFactory rpcFactory,
    RpcControllerFactory controllerFactory, ExecutorService pool, int primaryOperationTimeout)
    throws IOException {
    if (LOG.isTraceEnabled()) {
      LOG.trace("Scan table=" + tableName
          + ", startRow=" + Bytes.toStringBinary(scan.getStartRow()));
    }
    this.scan = scan;
    this.tableName = tableName;
    this.lastNext = System.currentTimeMillis();
    this.connection = connection;
    this.pool = pool;
    this.primaryOperationTimeout = primaryOperationTimeout;
    this.retries = conf.getInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER,
        HConstants.DEFAULT_HBASE_CLIENT_RETRIES_NUMBER);
    if (scan.getMaxResultSize() > 0) {
      this.maxScannerResultSize = scan.getMaxResultSize();
    } else {
      this.maxScannerResultSize = conf.getLong(
        HConstants.HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE_KEY,
        HConstants.DEFAULT_HBASE_CLIENT_SCANNER_MAX_RESULT_SIZE);
    }
    this.scannerTimeout = HBaseConfiguration.getInt(conf,
      HConstants.HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD,
      HConstants.HBASE_REGIONSERVER_LEASE_PERIOD_KEY,
      HConstants.DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD);

    // check if application wants to collect scan metrics
    initScanMetrics(scan);

    // Use the caching from the Scan.  If not set, use the default cache setting for this table.
    if (this.scan.getCaching() > 0) {
      this.caching = this.scan.getCaching();
    } else {
      this.caching = conf.getInt(
          HConstants.HBASE_CLIENT_SCANNER_CACHING,
          HConstants.DEFAULT_HBASE_CLIENT_SCANNER_CACHING);
    }

    this.caller = rpcFactory.<Result[]> newCaller();
    this.rpcControllerFactory = controllerFactory;

    this.conf = conf;
    initializeScannerInConstruction();
  }