You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Daniel Penning <d....@fire-development.com> on 2008/12/12 20:06:00 UTC
Singleton and org.apache.lucene.store.AlreadyClosed
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
Re: Singleton and org.apache.lucene.store.AlreadyClosed
Posted by Rahul Akolkar <ra...@gmail.com>.
Please post to the correct list, this is the Apache Commons user list.
-Rahul
On Fri, Dec 12, 2008 at 2:06 PM, Daniel Penning
<d....@fire-development.com> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org