What about the line in the if that doesn't execute the block,  if index-hits 
.hasNext() returns false?

Does this close the underlying structures ?

>>        if (hits != null && hits.iterator().hasNext()) {

and here 2 iterators are opened? perhaps this might be a problem, one for the 
if, the second for the for-each loop

Cheers

Michael

Am 01.04.2011 um 09:34 schrieb Mattias Persson:

> It looks correct to me (even without the call to close()) since the entire
> IndexHits is looped through. I'd very interested in a snippet of code
> reproducing this. Is it reproducable just be through lots of queries to an
> index, or are you doing lots of modifications as well? Many threads?
> 
> 2011/4/1 Axel Morgner <[email protected]>
> 
>> On 31.03.2011 09:29, Mattias Persson wrote:
>>> There are two things here:
>>> 
>>> The error you're getting is because you probably forget to close some
>>> IndexHits somewhere, IndexHits that you haven't iterated all the way
>>> through... could you check your code for such mistakes?
>> Hmm ... I checked the code. Iteration always goes through all hits I think:
>> 
>> IndexHits hits = index.query(new QueryContext(textualQueryString));
>> 
>> List<AbstractNode> result = nodeFactory.createNodes(hits);
>> 
>> The createNodes-Method looks like that:
>> 
>>    public List<AbstractNode> createNodes(final Iterable<Node> hits) {
>>        List<AbstractNode> nodes = new ArrayList<AbstractNode>();
>>        if (hits != null && hits.iterator().hasNext()) {
>>            for (Node node : hits) {
>>                AbstractNode n = createNode(node);
>>                nodes.add(n);
>>            }
>>        }
>>        return nodes;
>>    }
>> 
>> Maybe the IndexHits are not closed if thread gets interrupted?
>> 
>> Now I added a hits.close() after the createNodes line. More stress tests
>> will follow and reveal all flaws in my code ... ;-)
>> 
>>> The other one that doCommit always seems to be invoked I just tried and
>>> cannot reproduce, so may be something on your end? could you provide a
>> code
>>> snippet to reproduce this?
>> Debugged it, but was not able to isolate or reproduce it. Will keep an
>> eye on it. I'm quite sure it has to do with my asynchronous logging
>> service, but it seems that it is kinda hard to track down ...
>> 
>> Thanks for your help, and best regards
>> 
>> Axel
>> 
>> _______________________________________________
>> Neo4j mailing list
>> [email protected]
>> https://lists.neo4j.org/mailman/listinfo/user
>> 
> 
> 
> 
> -- 
> Mattias Persson, [[email protected]]
> Hacker, Neo Technology
> www.neotechnology.com
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to