hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Allan Yan <hailun...@gmail.com>
Subject Re: autoFlush
Date Fri, 12 Aug 2011 07:33:52 GMT
HTablePool uses HTableInterfaceFactory to return a HTableInterface.
While HTable implements HTableInterface, it doesn't mean calling
getTable method will always return HTable. Depends on how your
HTablePool is instantiated, your HTablePool instance may or may not
gives you HTable instance when you call getTable. For example, if you
create HTablePool instance without passing your own
HTableInterfaceFactory instance, as following:

HTablePool htablePool = new HTablePool(config, 10);

Internally, a HTableFactory is created and used for returning a HTable
instance whenever the htablePool.getTable() method is called.

However, to make your code bug free, you could check the object type
first before you cast it , like this:

HTableInterface table = tablePool.getTable(myTable);
if(table instanceof HTable)

On Thu, Aug 11, 2011 at 11:32 PM, Steinmaurer Thomas
<Thomas.Steinmaurer@scch.at> wrote:
> Typecast the return value of the table pool to HTable and you shoud be
> fine. E.g. I'm doing this:
> ...
> HTable table = (HTable) tablePool.getTable(this.hbaseTable);
> table.setAutoFlush(this.hbaseAPIuseAutoFlush);
> table.setWriteBufferSize(this.hbaseAPIwriteBufferSize);
> ...
> lg,
> Thomas
> -----Original Message-----
> From: steve.boyle@connexity.com [mailto:steve.boyle@connexity.com]
> Sent: Freitag, 12. August 2011 08:01
> To: user@hbase.apache.org
> Subject: autoFlush
> I want to do client-side write-caching to hbase.  I see the setAutoFlush
> method in HTable.  I do not see that in the HTableInterface that is
> returned from HTablePool.  Is there something equivalent to setAutoFlush
> on table instances from HTablePool?
> Thanks!

View raw message