I just attached a patch which:
1. prevents multiple close() of an IndexWriter
2. prevents an NPE if the writeLock was null.
We have been noticing this from time to time and I haven't been able to come up with a hard test case. This is just a bit of defensive programming to prevent it from happening in the first place. It would happen from time to time without any reliable cause.
Anyway...
Thanks...
Kevin
--
Please reply using PGP.
http://peerfear.org/pubkey.asc NewsMonster - http://www.newsmonster.org/
Kevin A. Burton, Location - San Francisco, CA, Cell - 415.595.9965
AIM/YIM - sfburtonator, Web - http://peerfear.org/
GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412
IRC - freenode.net #infoanarchy | #p2p-hackers | #newsmonster
--- IndexWriter.java.bak.close 2004-09-03 11:27:37.000000000 -0700 +++ IndexWriter.java 2004-09-03 11:32:02.000000000 -0700 @@ -107,6 +107,11 @@ */ private boolean useCompoundFile = false; + /** + * True when we have closed this IndexWriter + */ + protected boolean isClosed = false; + /** Setting to turn on usage of a compound file. When on, multiple files * for each segment are merged into a single file once the segment creation * is finished. This is done regardless of what directory is in use. @@ -183,15 +188,27 @@ }.run(); } } - + /** Flushes all changes to an index, closes all associated files, and closes the directory that the index is stored in. */ public synchronized void close() throws IOException { + + if ( isClosed ) { + return; + } + flushRamSegments(); ramDirectory.close(); - writeLock.release(); // release write lock + + if ( writeLock != null ) { + // release write lock + writeLock.release(); + } + writeLock = null; directory.close(); + isClosed = true; + } /** Release the write lock, if needed. */
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]