How can I check if a Lucene IndexWriter instance is valid/open?
问题 Sorry for the simple question, but there doesn't seem to be any obvious way. According to the documentation, it is recommended to keep a single instance of IndexWriter in memory that can be used again and again for updates, as opposed to opening and closing one for each change (which is much more costly). However, the documentation also states that the IndexWriter should be closed if an exception occurs (e.g. OutOfMemoryException ). Therefore, I need some way to check if my instance of