Not explict closing can lead especially when is allowed a lot of memory
to JVM but small amount is used that old files will stay on the disk on
linux.
Solution is in using ReentrantReadWriteLock
where the re-open method opens new indexreader at ThreadLocal
accuire write lock
saves old reference to IndexReader to his ThreadLocal
swaps global reference to new one
release write lock
close referenced by old one
if indexer and searcher are asynchronous (they don't know about each
other doing, index reopen is based f.e. on quartz every min or so)
take care about using compound file format - the new segments are
written to 'segments' file before they are created.
We wrote ours for NetSearch to handle this specific issue. I suggest you
create a holder class to hold the IndexReader and IndexSearcher, this
can close them in the finalizer. Clients keep the holder until they are
finished and then discard it. When it is completely de-referenced it
will be closed. We also remove old indexes this way as well. Create a
factory class for the holder that knows when an index is being updated,
and creates new holders, when the index is not being updated it returns
the same one each time.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]