lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie <>
Subject Re: File Handle Leaks During Lucene 3.0.2 Merge
Date Wed, 29 Sep 2010 18:50:07 GMT
  Hi Uwe

Thanks in advance for your help. Well, I just tried searching again and 
it made no difference. My LuceneIndex getReader() function
will call writer.getReader() on occasion or return a cached copy. To 
make sure that IndexReader's are closed when they are no longer needed,
I wrap the IndexReader as follows:

public class VolumeIndexReader extends FilterIndexReader {

     public VolumeIndexReader(IndexReader in) {

     public void finalize() {
         try { in.close(); } catch (Exception e) {}

     public IndexReader reopen(boolean readonly) throws IOException {
         return super.reopen(readonly);

You'll notice finalizer calls IndexReader.close(). After users conduct 
multiple searches, the index reader should be closed in time. Therefore,
its confusing to me to see that open handles are still present. Clearly, 
I am doing something wrong, but what?


On 2010/09/29 8:21 PM, Uwe Schindler wrote:
> The "deleted" files are only freed by OS kernel if no longer an IndexReader
> accesses them. Did you get a new realtime reader after merging and*closed*
> the old one?
> -----
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message