Search in sources :

Example 1 with CoprocessorHTableFactory

use of org.apache.phoenix.hbase.index.table.CoprocessorHTableFactory in project phoenix by apache.

the class IndexWriterUtils method getDefaultDelegateHTableFactory.

public static HTableFactory getDefaultDelegateHTableFactory(CoprocessorEnvironment env) {
    // create a simple delegate factory, setup the way we need
    Configuration conf = env.getConfiguration();
    // set the number of threads allowed per table.
    int htableThreads = conf.getInt(IndexWriterUtils.INDEX_WRITER_PER_TABLE_THREADS_CONF_KEY, IndexWriterUtils.DEFAULT_NUM_PER_TABLE_THREADS);
    LOG.trace("Creating HTableFactory with " + htableThreads + " threads for each HTable.");
    IndexManagementUtil.setIfNotSet(conf, HTABLE_THREAD_KEY, htableThreads);
    if (env instanceof RegionCoprocessorEnvironment) {
        RegionCoprocessorEnvironment e = (RegionCoprocessorEnvironment) env;
        RegionServerServices services = e.getRegionServerServices();
        if (services instanceof HRegionServer) {
            return new CoprocessorHConnectionTableFactory(conf, (HRegionServer) services);
        }
    }
    return new CoprocessorHTableFactory(env);
}
Also used : RegionCoprocessorEnvironment(org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment) RegionServerServices(org.apache.hadoop.hbase.regionserver.RegionServerServices) Configuration(org.apache.hadoop.conf.Configuration) CoprocessorHTableFactory(org.apache.phoenix.hbase.index.table.CoprocessorHTableFactory) HRegionServer(org.apache.hadoop.hbase.regionserver.HRegionServer)

Aggregations

Configuration (org.apache.hadoop.conf.Configuration)1 RegionCoprocessorEnvironment (org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment)1 HRegionServer (org.apache.hadoop.hbase.regionserver.HRegionServer)1 RegionServerServices (org.apache.hadoop.hbase.regionserver.RegionServerServices)1 CoprocessorHTableFactory (org.apache.phoenix.hbase.index.table.CoprocessorHTableFactory)1