> > I dunno, I'm not really sure we should encourage adding more reference > counting to Lucene (I think we should discourage instead!) >
But we already have (DirectoryTaxonomyReader). Why should we discourage that? Lets please not do this! > Why? Today whoever manages IndexSearcher instances needs to call s.getIndexReader().incRef()/decRef(). Why not call on IndexSearcher itself? Are you against this cuz of a specific reason? Because I see that as just cosmetics, i.e.: - IR already implements all these methods, so we add nothing. - DirTaxoReader already implements all these methods (except for tryIncRef()), so we add nothing. - IndexSearcher does not implement these methods, but could easily implement them by delegating to the IR instance, saving the user to do so. And if we add the interface, we could do really nice things with SearcherManager and SearcherLifetimeManager. E.g., today I wrote my own SearcherManager version, which manages an IndexSearcher and TaxoReader pair. But if you think about it, SearcherManager is really a generic utility which manages objects via ref counting, and occasionally refreshes their state. SearcherLifetimeManager almost purely works with ref counting. I think that if we add this interface, we could generalize those twos (without affecting the performance of SM!). I don't think its awkward, maybe instead you call yours ReaderManager > and always return a new IndexSearcher, or other possibilities. > If I'll want to have a ReaderManager, I'll return an IndexReader and let the caller init IndexSearcher if he wants to. I guess I don't understand what you are against, so could you please clarify this? We did the same thing with the TwoPhaseCommit interface and we're using the Closeable interface too, in order to write better tools. So what's wrong with a RefCount interface, when in practice it won't change any implementation? Shai On Sun, Dec 11, 2011 at 2:48 PM, Robert Muir <[email protected]> wrote: > On Sun, Dec 11, 2011 at 2:23 AM, Shai Erera <[email protected]> wrote: > > Hi > > > > I would like to introduce a RefCount interface with the methods: > incRef(), > > tryIncRef(), decRef() and getRefCount(). > > I dunno, I'm not really sure we should encourage adding more reference > counting to Lucene (I think we should discourage instead!) > > > > > Also, I think it will be good if IndexSearcher implements this interface > > too, delegating calls to its underlying indexReader. > > Lets please not do this! > > > 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(). > > I don't think its awkward, maybe instead you call yours ReaderManager > and always return a new IndexSearcher, or other possibilities. > > -- > lucidimagination.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
