lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zender00 <>
Subject Re: Singleton and Lucene:
Date Mon, 15 Dec 2008 11:06:02 GMT

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:
> "    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:
Sent from the Lucene - Java Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message