hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 魏超 <nnever...@gmail.com>
Subject About Filter hold private Variable values
Date Fri, 20 Jan 2012 08:19:52 GMT
Hello,

I got a self-defined Filter like this:

class FilterA{

    *private int count*;

    ...

}


and used as:

Scan scan = new Scan(...);
> scan.addFilter(new FilterA());
> ...
> *while(someCondition){
> *    ResultScanner  scanner = htable.getScanner(scan);
>     .....
> *}*

*
*
the value of "count" in FilterA would *changed* var loop in the WHILE. It
works on HBase 0.90x, but when we upate to HBase0.92rc4, it turns out
that *FilterA
lost it's "count" value* during while loop.

I try throw a Excpetion in FilterA's construct method and find  "public
FilterA()" would called every time when getScanner called. So during the
loop filter get a new instance each time.

The Question is, how can i *keep a private variable's  value in Filter
between two calls of getScanner(scan)*?  or why should not to do like this?

Thanks~

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