For #1, single Hconnection should work.
For #2, can you clarify ? As long as the hbase-site.xml used to create
the Hconnection
is still valid, you can continue using the connection.
For #3, they're handled by the connection automatically.
For #4, the HTable ctor you cited doesn't exist in master branch.
You can control the following parameters for the ThreadPoolExecutor - see
HTable#getDefaultExecutor():
int maxThreads = conf.getInt("hbase.htable.threads.max", Integer.
MAX_VALUE);
if (maxThreads == 0) {
maxThreads = 1; // is there a better default?
}
int corePoolSize = conf.getInt("hbase.htable.threads.coresize", 1);
long keepAliveTime = conf.getLong("hbase.htable.threads.keepalivetime",
60);
On Sun, Mar 13, 2016 at 3:12 AM, Shushant Arora <[email protected]>
wrote:
> I have a requirement to use long running hbase client in application
> server.
>
> 1.Do I need to create multiple HConnections or single Hconnection will
> work?
> 2. DO I need to check whether Hconnection is still active before using it
> to create Htable instance.
> 3.DO I need to handle region split and regionserver changes while using
> Hconnection or are they handled automatically.
> 4.Whats the use of thread pool in Htable instance.
> ExecutorService threadPool;
> HTable h = new HTable(conf, Bytes.toBytes("tablename"), threadPool);
>
>
> Thanks!
>