lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Diviacco <patrick.divia...@gmail.com>
Subject how to delete a RAMDirectory from memory
Date Mon, 04 Apr 2011 11:22:39 GMT
Since I need to overwrite an old ramDirectory file and I don't want memory
leaks, I have the following code lines to close first the existing
RAMDirectory and create a new one.

INDEX_DIR.close();
INDEX_DIR = new RAMDirectory();

However, I get the following exception. Should I remove close() line and
just create a new RAMDirectory ? The old one will be deleted anyway ?

thans

Exception in thread "main" org.apache.lucene.store.AlreadyClosedException:
this Directory is closed
at org.apache.lucene.store.Directory.ensureOpen(Directory.java:224)
at org.apache.lucene.store.RAMDirectory.listAll(RAMDirectory.java:86)
at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:529)
at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:481)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:256)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:249)
at org.apache.lucene.index.IndexReader.indexExists(IndexReader.java:915)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:740)
at CollectionIndexer.run(CollectionIndexer.java:85)
at Clusterer.<init>(Clusterer.java:76)
at Main.main(Main.java:11)

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