That's true, we can share the connection, but the problem is, HConnection implements Closeable, and hence its close method is public. If you share the same connection in your api, you always have to check if the current connection is closed before you return it to the client, check previous emails to see how I was trying to achieve that. Now, I am thinking of creating a wrapper around HConnection that overrides HConnection close method and make it empty, just to make sure it's never closed
On Sun, Feb 15, 2015 at 8:26 PM, Serega Sheypak <serega.shey...@gmail.com> wrote: > I don't understand you. > There is a single instance of servlet per application. > Servlet.init method called once. Here you can instantiate HConnection and > solve ANY concurrency problems. HConnection is tread-safe. Just don't close > it and reuse. > Then just use HConnection to get HTable. > > What problem you are trying to solve? > > > 2015-02-15 9:23 GMT+03:00 David chen <c77...@163.com>: > > > If sharing one HConnection for the whole application, when concurrency to > > access servlets increases to a threshold, whether or not it will > influence > > the application performance? But if increasing the sharing HConnection > > number, the problem will be relieved? >