lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Lea" <ian....@gmail.com>
Subject Re: Singleton and Lucene: org.apache.lucene.store.AlreadyClosed
Date Tue, 16 Dec 2008 10:09:42 GMT
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 <danielpenning@gmx.net> wrote:
>
> 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 constructs an IndexReader/IndexWriter in its constructor) and
> return this instance to objects which want to execute some lucene
> operations. So I only applied the singleton-pattern.
> I am still wondering why these pattern results in my exception. Why could it
> happen, that these Streams (IndexWriter/IndexReader) close itself. In my
> opinion it is completely legal to do so.
>
> Any other suggestions?
>
>
>
> polx wrote:
>>
>>
>> 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
>>> handle my singleton. How did you implement your singleton with
>>> lucene? Which
>>> lucene version?
>>
>> 2.3.1, source code APL and GPL at:
>>    http://svn.activemath.org/intergeo/Platform/SearchI2G/index/
>>
>> in another project, this was used with Lucene 2.0.
>>
>> paul
>>
>>> polx wrote:
>>>>
>>>> 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 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 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 in this object like an IndexWriter and IndexReader. These
>>>>>> objects are created in the constructor and I can access them
>>>>>> directly in
>>>>>> the constructor successfully.
>>>>>> GetInstance() now returns this lucene object and I have to execute
>>>>>> some
>>>>>> operations on it. But the IndexWriter seems to be closed meanwhile
>>>>>> and I
>>>>>> got the exception:
>>>>>>
>>>>>> "org.apache.lucene.store.AlreadyClosed    Exception: this
>>>>>> IndexWriter is
>>>>>> closed" when my object tries to writer some documents.
>>>>>>
>>>>>> How could this happen? Isn't it possible to use lucene with a
>>>>>> singleton-pattern?
>>>>>>
>>>>>> Kind regards,
>>>>>> D. Penning
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Singleton-and-Lucene%3A-org.apache.lucene.store.AlreadyClosed-tp20983056p21011945.html
>>>>> Sent from the Lucene - Java Users mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Singleton-and-Lucene%3A-org.apache.lucene.store.AlreadyClosed-tp20983056p21012798.html
>>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Singleton-and-Lucene%3A-org.apache.lucene.store.AlreadyClosed-tp20983056p21022920.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message