Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-16 Thread Ian Lea
If the reopen suggestion doesn't fix it, I suggest that you cut down your singleton class to the absolute minimum, wrap it in a junit test case that demonstrates the problem and post the code here. -- Ian. On Mon, Dec 15, 2008 at 10:06 PM, Zender00 wrote: > > Hi Paul, > thanks for your reply.

Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-16 Thread Baozhen Jia
some docs from Lucene 2.4.0: * IndexReader new = r.reopen(); * if (new != reader) { * ... // reader was reopened * reader.close(); * } * reader = new; Did you follow this instruction? It's bad in case of concurrent access in my opinion. Do not close the reader, and try

Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-15 Thread Zender00
Hi Paul, thanks for your reply. I compared your source code and it seems that you are using the same mechanism for the singleton like me... I am using lucene 2.4 and get the exception above explained. I am wondering why because I only create an instance of my lucene object (which itself construct

Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-15 Thread Paul Libbrecht
Le 15-déc.-08 à 13:09, Zender00 a écrit : in my opinion it is possible to use a reader and writer simultanesously on the same index. In my already working lucene class, I use they are both open all the time. mmmh... But this isnt the reason for my exception. It seems that lucene cannot

Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-15 Thread Zender00
Hi paul, in my opinion it is possible to use a reader and writer simultanesously on the same index. In my already working lucene class, I use they are both open all the time. But this isnt the reason for my exception. It seems that lucene cannot handle my singleton. How did you implement your si

Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-15 Thread Paul Libbrecht
We use singletons all the time, Just be careful that are writer and a reader cannot be opened simultaneously on the same index. Either you write or your read (and delete). paul Le 15-déc.-08 à 12:06, Zender00 a écrit : I extend my original post: How is it possible to use lucene in 2 di

Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-15 Thread Zender00
I extend my original post: How is it possible to use lucene in 2 diffent classes / objects, if I dont want to use static methods/variables? (one object read/writer, the other is read only) Kind regards, D. Penning Zender00 wrote: > > Hi, > I tried to implement a singleton pattern for my already

Singleton and Lucene: org.apache.lucene.store.AlreadyClosed

2008-12-12 Thread Zender00
Hi, I tried to implement a singleton pattern for my already working lucene object. But there is a strange error when I tried to access the instance. When my Singleton GetInstance() method is executed for the first time it creates a new instance of my lucene object. There are some member variables