You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Venkatesh <vr...@aol.com> on 2010/08/02 05:13:23 UTC

HTable object - how long it is valid

 Hi

If I construct new HTable() object upon my app init, is it valid until my app is shutdown?
I read in earlier postings that it is better to construct HTable once for performance reasons.
Wonder if underlying connection & other resources are kept around for ever for put/scan/..

Also ..when do I call close()..upon every operation (put/get/..) ? to avoid memory leaks

thanks
venkatesh





 



Re: HTable object - how long it is valid

Posted by Jean-Daniel Cryans <jd...@apache.org>.
A HTable doesn't contain any state unless you use the write buffer.
close() only flushes the write buffer. The only thing you need to be
sure of is to close your scanners (they have a timeout on the region
server if you stop using them, but better be clean).

J-D

On Sun, Aug 1, 2010 at 8:13 PM, Venkatesh <vr...@aol.com> wrote:
>
>  Hi
>
> If I construct new HTable() object upon my app init, is it valid until my app is shutdown?
> I read in earlier postings that it is better to construct HTable once for performance reasons.
> Wonder if underlying connection & other resources are kept around for ever for put/scan/..
>
> Also ..when do I call close()..upon every operation (put/get/..) ? to avoid memory leaks
>
> thanks
> venkatesh
>
>
>
>
>
>
>
>
>