We have a custom IndexSearcher that fetches a near real-time reader and calls FieldCache.DEFAULT.getStrings() after a calculated length of time or when certain changes are made to the index (requiring immediate searchability). The thread slept for that length of time unless an interrupt was given. wait/notify should accomplish the same without interrupting NIOFSDirectory.
----- Original Message ---- From: Michael McCandless <luc...@mikemccandless.com> To: java-user@lucene.apache.org Sent: Thu, April 8, 2010 3:50:41 PM Subject: Re: ClosedChannelException from IndexWriter.getReader() OK, phew :) Yea warming in a separate thread is common... but why does Thread.interrupt() come into play in your app for warming? Mike On Thu, Apr 8, 2010 at 4:38 PM, Justin <cry...@yahoo.com> wrote: > In fact, we are using Thread.interrupt() to warm up a searcher in a separate > thread (not really that uncommon, is it?). We may switch to > Object::wait(long) and Object::notify() instead of switching the Directory > implementation. Thanks for recognizing the issue! > > > > > ----- Original Message ---- > From: Michael McCandless <luc...@mikemccandless.com> > To: java-user@lucene.apache.org > Sent: Thu, April 8, 2010 2:41:07 PM > Subject: Re: ClosedChannelException from IndexWriter.getReader() > > Are you using Future.cancel or directly using Thread.interrupt? If so > it could be this nasty issue: > > https://issues.apache.org/jira/browse/LUCENE-2239 > > Try temporarily using a Directory impl other than NIOFSDirectory and > see if the problem still happens? > > Mike > > On Thu, Apr 8, 2010 at 2:14 PM, Justin <cry...@yahoo.com> wrote: >> I'm getting a ClosedChannelException from IndexWriter.getReader(). I don't >> think the writer has been closed and, if it were, I would expect an >> AlreadyClosedException as described in the API documentation. Does anyone >> have an idea what might be wrong? The disk is not full and the permissions >> look correct. >> >> Here the stack trace from revision 926791: >> >> java.nio.channels.ClosedChannelException >> at sun.nio.ch.FileChannelImpl.ensureOpen(FileChannelImpl.java:88) >> at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:613) >> at >> org.apache.lucene.store.NIOFSDirectory$NIOFSIndexInput.readInternal(NIOFSDirectory.java:150) >> at >> org.apache.lucene.store.BufferedIndexInput.readBytes(BufferedIndexInput.java:139) >> at >> org.apache.lucene.index.CompoundFileReader$CSIndexInput.readInternal(CompoundFileReader.java:257) >> at >> org.apache.lucene.store.BufferedIndexInput.refill(BufferedIndexInput.java:160) >> at >> org.apache.lucene.store.BufferedIndexInput.readByte(BufferedIndexInput.java:39) >> at org.apache.lucene.store.IndexInput.readInt(IndexInput.java:74) >> at org.apache.lucene.index.FieldsReader.<init>(FieldsReader.java:114) >> at >> org.apache.lucene.index.SegmentReader$CoreReaders.openDocStores(SegmentReader.java:294) >> at >> org.apache.lucene.index.SegmentReader.openDocStores(SegmentReader.java:590) >> at >> org.apache.lucene.index.IndexWriter$ReaderPool.get(IndexWriter.java:640) >> at >> org.apache.lucene.index.IndexWriter$ReaderPool.getReadOnlyClone(IndexWriter.java:591) >> at >> org.apache.lucene.index.DirectoryReader.<init>(DirectoryReader.java:138) >> at >> org.apache.lucene.index.ReadOnlyDirectoryReader.<init>(ReadOnlyDirectoryReader.java:36) >> at org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:423) >> at org.apache.lucene.index.IndexWriter.getReader(IndexWriter.java:387) >> >> Thanks, >> Justin >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org