hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Purtell <apurt...@apache.org>
Subject Re: HTablePool question
Date Mon, 13 Jul 2009 22:49:21 GMT
The current semantics are to use the factory method HTablePool.getPool()
to create one pool per table. There are a couple of improvements which
could be made here:
   - Use a factory class to make things clearer
   - Make the HTablePool constructor protected
Also, this is a very simple class which may not match up with anyone's
use case. As I recall this is a quickly constructed answer to a
suggestion made on IRC one day. Patches are always welcome.

   - Andy






________________________________
From: Ken Weiner <ken@gumgum.com>
To: hbase-user@hadoop.apache.org
Sent: Monday, July 13, 2009 12:37:38 PM
Subject: Re: HTablePool question

I was just looking at the same code and I am wondering what the intended
usage pattern is.  HTablePool has both a static factory-like method
HTablePool.getPool() and a public constructor.  Should a client be using the
static method to get pools for each table of interest or should the client
instantiate a pool per table on its own and manage those references itself?

On Fri, Jul 10, 2009 at 5:39 PM, Erik Holstad <erikholstad@gmail.com> wrote:

> Hey Vaibhav!
> I haven't used HTablePool myself, but we used to have something very
> similar
> that we used internally.
> But just looked at the code and will try to answer your questions.
>
>
> On Thu, Jul 9, 2009 at 6:48 PM, Vaibhav Puranik <vpuranik@gmail.com>
> wrote:
>
> > Hi,
> >
> > It looks like HTablePool is designed to have one instance of HTablePool
> per
> > table.
>
> Yes, it looks that way.
>
>
> >
> >
> > I am confused by the static map inside HTablePool class. If we can
> > instantiate one HTablePool per table, what's the use of the map?
>
> The reason I think you are a little bit confused is because the classes
> mixes a static getter with a non static class, so what you do is that you
> use the static getPool to get you HTablePool and then you use the non
> static
> methods to work on it.
>
>
> >
> > Furthermore, the map is static and there is no way to add multiple tables
> > to
> > it.
>
> Yes, it is static, but not final, so every time  you ask for a pool for a
> table that is not in the static map, it creates that key value pair. What
> you cannot do though is to change the number of HTable instances after you
> called it ones, not sure if you need this, but should be to hard to add if
> you do.
>
> >
> >
> > Regards,
> > Vaibhav
> >
>
> Regards Erik
>



      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message