hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dhaval Shah <prince_mithi...@yahoo.co.in>
Subject Re: Connection pool Concurrency in HBase
Date Mon, 04 Aug 2014 17:50:45 GMT
HConnection connection = HConnectionManager.createConnection(config); will give you the shared

Do not close the connection object until all your threads are done using it. In your use case
you should not close it when you close the table since other threads may be using it or may
need to use it in the future


From: Serega Sheypak <serega.sheypak@gmail.com>
To: user@hbase.apache.org 
Sent: Monday, 4 August 2014 1:44 PM
Subject: Connection pool Concurrency in HBase

Hi, I'm trying to understand how does connection pooling works in HBase.
I've seen that
is recommended to use.

I have a servlet, it's instance shaed among many threads.
What is a good way to use connection pooling in this case?

Is this

HConnection connection = HConnectionManager.createConnection(config);
HTableInterface table = connection.getTable("table1");
try {
   // Use the table as needed, for a single operation and a single thread
} finally {

1. enough to reuse connection and they wouldn't be opened each time?
2. why do I have to close ALL: table and connection? It's done by design?  

View raw message