lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ankit Murarka <>
Subject Re: Stream Closed Exception and Lock Obtain Failed Exception while reading the file in chunks iteratively.
Date Mon, 02 Sep 2013 06:56:44 GMT

I think you might be referring to the close method not present in catch 
method. if that's so, that is purposely done for the time being...

Else if the execution happens properly, then the flow won't go to catch 
as of now. Obviously the close will be present both in catch and finally 

But I don't think this is possibly the root of this problem.

There seems to be another problem which is causing this issue..Would 
appreciate some guidance..

On 9/2/2013 12:11 PM, Trejkaz wrote:
> On Mon, Sep 2, 2013 at 4:10 PM, Ankit Murarka
> <>  wrote:
>> There's a reason why Writer is being opened everytime inside a while loop. I
>> usually open writer in main method itself as suggested by you and pass a
>> reference to it. However what I have observed is that if my file contains
>> more than 4 lakh lines, the writer.add(doc) line does not execute and throws
>> an OutOfMemoryError although JVM is provided with enough heap.
> The problem isn't opening it multiple times (although that does seem
> unnecessary too), the problem is that half the time you're not closing
> it.
> Try refactoring to always use the try(){} syntax so that all your
> Closeable objects are being closed properly. You'll find all sorts of
> issues with the code you posted.
> TX
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:


Ankit Murarka

"What lies behind us and what lies before us are tiny matters compared with what lies within

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

View raw message