We may need to know what you are planning to do with the connection pool to help.
Mingtao Sent from iPhone > On Aug 4, 2014, at 1:44 PM, Serega Sheypak <[email protected]> wrote: > > Hi, I'm trying to understand how does connection pooling works in HBase. > I've seen that > https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HConnectionManager.html > 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 { > table.close(); > connection.close(); > } > > > 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?
