Sujee, HTablePool uses ConcurrentHashMap to store HTable(s). Hence it's thread safe. Read the following docs for more information:
http://download.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentHashMap.html Regards, Vaibhav On Tue, Aug 23, 2011 at 4:34 PM, Sujee Maniyam <[email protected]> wrote: > Hi all, > > Right now I have a java client program that accesses Hbase in multiple > threads for read / write. Each thread creates its own instance of HTable > of > the _same_ table. > > I am looking into HTablePool class. Not clear on if it is a correct/better > choice for accessing the _same_ table with multiple threads. > > Is this a valid / thread-safe ? > > create HtablePool in 'main' > pass HTablePool instance to threads > each thread does a 'htablepool.get(table)' > read / write to table > 'htablepool.put (table) ' when done > (all this is done within a single JVM) > > thanks > Sujee Maniyam > http://sujee.net >
