lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Urgent! Forgot to close IndexWriter after adding Documents to the index.
Date Wed, 23 Mar 2011 00:15:19 GMT

: I think finalize() is that not trustworthy, in that it may
: never be called, e.g. in case GC happened to not collect the specific
: object,
: and so the way for programmers to guarantee execution of any code
: at shutdown is with shutdown hooks, I guess this is that what you meant,

i'm not suggesting that this be documented as a *reliable* garunteed way 
to get a commit, just as a safety net for nocie users.  I don't know 
enough about finer points of shutdown hooks to comment on the distinctio, 
but my off the cuff assumption is that a shutdown hook would be a bad idea 
... in a long running program wouldn't thta keep the IndexWriter 
from being GCed until shutdown?

: > Yes. Totally unexpected magical behaviour.
: > What if I didn't commit something on purporse?
	...
: Applications can call rollback() in this case.

or more specificly along the lines of my original point: people who read 
the docs carefully are more likely to know about rollback and call it 
explicitly, or to see the autoClose option and explicitly set it to false 
(or use a constructor where it defualts to false)

-Hoss

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


Mime
View raw message