Doug Cutting wrote:
So, to implement this we might:

1. Remove the writeLock, segmentInfos and doDelete() from IndexReader.
directory should also be removed. It should go into SegmentReader and SegmentsReader. close() would also become abstract.

2. Change IndexReader.delete() to be abstract.


3. Rename MultiReader.doDelete() to delete(), so that MultiReader.delete() simply delegates to all sub-indexes.

4. Define SegmentReader.delete() to perform version checking and locking, then call the protected method doDelete().

5. Define SegmentsReader as a package-private subclass of MultiReader. It requires each of its sub-indexes to be a SegmentReader. It overrides the delete() method to check versions, lock the directory, then call doDelete() on each sub-index.

What do you think?

Looks like a very good design. The only thing I donīt like is that version checking and locking in delete() is implementeed twice in SegmentReader and SegmentsReader. However, I donīt see another solution since multiple inheritence is not possible in Java and SegmentsReader should definitely extend MultiReader. Maybe version checking and locking should be implemented in an additional class used by SegmentReader and SegmentsReader.

I accidentely stumbled over this one: Shouldnīt we obtain a write lock for setNorm too?

If you agree, I could try to do the proposed implementation in the next few days. What do you think?

Christoph


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to