sure. the method that does the reopening of the index is synchronized. it would be possible for in-flight searches to be using the reader, but that wasn't the problem since I was the only one testing it. here's the full exception that was thrown: org.apache.lucene.store.AlreadyClosedException: this Directory is closed at org.apache.lucene.store.Directory.ensureOpen(Directory.java:220) at org.apache.lucene.store.FSDirectory.list(FSDirectory.java:320) at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:533) at org.apache.lucene.index.SegmentInfos.readCurrentVersion(SegmentInfos.java:366) at org.apache.lucene.index.DirectoryIndexReader.isCurrent(DirectoryIndexReader.java:188) at org.apache.lucene.index.DirectoryIndexReader.reopen(DirectoryIndexReader.java:124) at net.mainsequence.pcr.lucene.LuceneHandler.reopen(LuceneHandler.java:450) at net.mainsequence.pcr.lucene.LuceneServlet.searchIndex(LuceneServlet.java:578) at net.mainsequence.pcr.lucene.LuceneServlet.processRequest(LuceneServlet.java:114) at net.mainsequence.pcr.lucene.LuceneServlet.doPost(LuceneServlet.java:99) at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509) at java.lang.Thread.run(Unknown Source)
Sincerely, Chris Salem Development Team Main Sequence Technologies, Inc. PCRecruiter.net - PCRecruiter Support ch...@mainsequence.net P: 440.946.5214 ext 5458 F: 440.856.0312 This email and any files transmitted with it may contain confidential information intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. Main Sequence Technologies, Inc. 4420 Sherwin Rd. Willoughby OH 44094 www.pcrecruiter.net ----- Original Message ----- To: java-user@lucene.apache.org From: Michael McCandless <luc...@mikemccandless.com> Sent: 3/19/2009 4:41:35 PM Subject: Re: LUCENE-1453 not fixed? Hmm that's good that it resolves your issue, but not good in that it means the bug may in fact still be there. Can you answer the other questions below? Mike Chris Salem wrote: > Changing it to use the FSDirectory instead of the indexPath string > seems to work. thanks alot! > Sincerely, > Chris Salem > > > ----- Original Message ----- > To: java-user@lucene.apache.org > From: Michael McCandless <luc...@mikemccandless.com> > Sent: 3/19/2009 2:17:33 PM > Subject: Re: LUCENE-1453 not fixed? > > > > Hmm... the code looks OK. > > Though: can multiple threads call that method at the same time? > > And: could in-flight searches be using the reader, when you close it? > > If instead of opening with String indexPath, you pass in an > FSDirectory that you opened, do you still hit the > AlreadyClosedException? > > Can you post the full exception? > > Mike > > Chris Salem wrote: > >> I'm using Lucene 2.4.1 and I'm still getting an >> AlreadyClosedException when trying to reopen an IndexReader. Here's >> the code I'm using, in case I'm doing something wrong, there isn't >> an error if I don't close the old reader: >> String indexPath = "C:\\Lucene\\test"; >> IndexReader reader = IndexReader.open(indexPath); >> .. >> IndexReader tempReader; >> try { >> tempReader = reader.reopen(); >> if(tempReader != reader){ >> System.out.println("reader reopened"); >> reader.close(); >> }else{ >> System.out.println("reader has not changed"); >> } >> reader = tempReader; >> return this; >> } catch (CorruptIndexException e) { >> e.printStackTrace(); >> } catch (IOException e) { >> e.printStackTrace(); >> } >> Sincerely, >> Chris Salem > > > --------------------------------------------------------------------- > 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 (The following links were included with this email:) http://www.pcrecruiter.net/ http://www.pcrecruiter.net/support.htm mailto:ch...@mainsequence.net (The following links were included with this email:) http://www.pcrecruiter.net/ http://www.pcrecruiter.net/support.htm mailto:ch...@mainsequence.net