hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zizon <zzd...@gmail.com>
Subject Re: autoFlush
Date Fri, 12 Aug 2011 07:42:57 GMT
or do something like this:

HTablePool pool = new HTablePool(config, maxSize, new HTableFactory() {
@Override
public HTableInterface createHTableInterface(Configuration config,
 byte[] tableName) {
try {
HTable table= new HTable(config, tableName);
 *table.setAutoFlush(false);*
return table;
} catch (IOException ioe) {
 throw new RuntimeException(ioe);
}
}
 });

pass a user define  HTableInterfaceFactory to instantiate htabl pool

On Fri, Aug 12, 2011 at 3:33 PM, Allan Yan <hailunyan@gmail.com> wrote:

> 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)
>    ((HTable)table).setAutoFlush(true)
>
>
> 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!
> >
>

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