Hi

I would like to introduce a RefCount interface with the methods: incRef(),
tryIncRef(), decRef() and getRefCount().

These methods are already declared today on IndexReader and TaxonomyReader
(module/facet), and I see no reason why we wouldn't have an interface for
doing that. Then it will allow someone to e.g. incRef() a set of RefCount
objects or something like that.

Also, I think it will be good if IndexSearcher implements this interface
too, delegating calls to its underlying indexReader. Because today it seems
very awkward to me that if I want to write a SearcherManager-like object,
which manages IndexSearchers and essentially keeps track of their
references, I need to know that I should call
s.getIndexReader().inc/decRef().

Following that, it may be possible to make SearcherManager /
SearcherLifetimeManager generic objects which take RefCount objects, but
that's for another :).

What do you think?

Shai

Reply via email to