You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Joseph Ottinger <jo...@enigmastation.com> on 2005/01/12 15:42:18 UTC

HELP! Directory is NOT getting closed!

*sigh* Yet again, I apologize. I'm generating altogether too much traffic
here lately!

I'm stuck. I have a custom Directory, and I *need* a callback point so I
can clean up. There's a method for this: Directory.close(), which I've
overridden.

It never gets called!

According to IndexWriter.java, line 246 (in 1.4.3's codebase), if closeDir
is set, it's supposed to close the directory. That's fine - but that leads
me to believe that for some reason, closeDir is *not* set.

Why? Under what circumstances would this not be true, and under what
circumstances would you NOT want to close the Directory?

This is absolutely slaughtering my attempt at a Directory, because I need
a single unit-of-work, and I need a place to commit it, when it's done. If
I commit it inside the directory's innards, then the UOW gets corrupted
(and looks like it's more than one atomic action, which is EXACTLY what I
don't need.)

-----------------------------------------------------------------------
Joseph B. Ottinger                             http://enigmastation.com
IT Consultant                                    joeo@enigmastation.com


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


Re: HELP! Directory is NOT getting closed!

Posted by Joseph Ottinger <jo...@enigmastation.com>.
On Wed, 12 Jan 2005, Morus Walter wrote:

> Joseph Ottinger writes:
> >
> > According to IndexWriter.java, line 246 (in 1.4.3's codebase), if closeDir
> > is set, it's supposed to close the directory. That's fine - but that leads
> > me to believe that for some reason, closeDir is *not* set.
> >
> > Why? Under what circumstances would this not be true, and under what
> > circumstances would you NOT want to close the Directory?
> >
> >From the sources, you can see, that is is true only, if the directory
> is created by the IndexWriter itself. If you provide a directory to
> the IndexWriter you have to close it yourself.
>

ARGH! (I've been saying that a lot lately!)

Okay, I was looking at the sources but missed that. Thank you very much.
*sigh*

-----------------------------------------------------------------------
Joseph B. Ottinger                             http://enigmastation.com
IT Consultant                                    joeo@enigmastation.com


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


Re: HELP! Directory is NOT getting closed!

Posted by Morus Walter <mo...@tanto.de>.
Joseph Ottinger writes:
> 
> According to IndexWriter.java, line 246 (in 1.4.3's codebase), if closeDir
> is set, it's supposed to close the directory. That's fine - but that leads
> me to believe that for some reason, closeDir is *not* set.
> 
> Why? Under what circumstances would this not be true, and under what
> circumstances would you NOT want to close the Directory?
> 
>From the sources, you can see, that is is true only, if the directory
is created by the IndexWriter itself. If you provide a directory to
the IndexWriter you have to close it yourself.

HTH
	Morus

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