FAQ
Why not create new lightweight references to the the directory, and
using WeakReferences and ReferenceQueues and avoid the need to
manually use incRef and decRef ?

Tracking state like this almost always leads to problems - this is
why Java has GC in the first place - because it is very difficult to
perform this sort of resource tracking.
On Nov 18, 2008, at 2:37 PM, Michael McCandless wrote:


I think this makes sense.

But: I think we'd need to add incRef/decRef to Directory? And fix
the newly added logic in DirectoryIndexReader that now clones the
dir during reopen (because it's hardwired to only work with FSDir).

Mike

Mark Miller wrote:
Does anyone object to making IndexReader

private static IndexReader open(final Directory directory, final
boolean closeDirectory, final IndexDeletionPolicy deletionPolicy,
final IndexCommit commit, final boolean readOnly) throws
CorruptIndexException, IOException {
return DirectoryIndexReader.open(directory, closeDirectory,
deletionPolicy, commit, readOnly);
}

public? I think it can be convenient to be able to both control
the closing of the Directory yourself, as well as give the
Directory to an IndexReader to manage.

If you have created a DirectoryFactory to supply your
IndexReaders, you will want to supply external Directory
implementations to the IndexReaders, and its quite possible that
you then want the IndexReader to take over the lifecycle of the
Directory for you rather than having to juggle the two separately

- Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 4 | next ›
Discussion Overview
groupjava-dev @
categorieslucene
postedNov 15, '08 at 5:49p
activeNov 19, '08 at 9:07p
posts4
users3
websitelucene.apache.org

People

Translate

site design / logo © 2021 Grokbase