Hi all, I'm on cdh3u3 (hbase 0.90.4) and I need to provide a bunch of row keys based on a column value (e.g. give me all keys where column "dataset" = 1234). That's straightforward using a scan and filter. The trick is that I want to return an Iterator over my key type (Integer) rather than expose HBase internals (i.e. Result), so I need some kind of Decorator that wraps the Iterator<Result>. For every call to next() I'd then call the underlying iterator's next() and extract my Integer key from the Result. That all works fine, but what I'm wondering is what resources the Iterator<Result> is holding, and how I can release those from my decorator.
In my current implementation the decorator's constructor looks like: public OccurrenceKeyIterator(HTablePool tablePool, String occurrenceTableName, Scan scan) and the constructor builds the ResultScanner and subsequent iterator. In my hasNext() method I can check the underlying iterator and if it says false I can shutdown my scanner and return the table to the TablePool. But what if the end-user never reaches the end of the Iterator, or just dereferences it? Am I at risk of leaking tables, connections or anything else? Any tips on what I should do? Thanks, Oliver -- Oliver Meyn Software Developer Global Biodiversity Information Facility (GBIF) +45 35 32 15 12 http://www.gbif.org
