FAQ
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.(CollectionIndexer.java:85)
at Clusterer.(Main.java:11)

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedApr 4, '11 at 11:23a
activeApr 4, '11 at 11:23a
posts1
users1
websitelucene.apache.org

1 user in discussion

Patrick Diviacco: 1 post

People

Translate

site design / logo © 2022 Grokbase