Strange behaviour of GraphNode
------------------------------
Key: CLEREZZA-418
URL: https://issues.apache.org/jira/browse/CLEREZZA-418
Project: Clerezza
Issue Type: Question
Environment: win7
Reporter: franco fallica
Priority: Minor
Hi all,
I just ran into an interesting issue, and I want to let you know.
I've got a method like that. ( We use that GraphNode a lot before we pass it to
that method)
protected void addToLuceneIndex(GraphNode clip){
(0)
// then some stuff like that
Document doc = new Document();
Iterator<Literal> iter;
doc.add(new Field(LuceneDocumentClips.url,
URLParser.formIndexableURL(((UriRef) clip.getNode()).getUnicodeString()),
Field.Store.YES, Field.Index.NOT_ANALYZED));
(1) System.out.println("before getLiterals");
iter = clip.getLiterals(DCTERMS.title);
(2) System.out.println("after getLiterals");
while (iter.hasNext()) {
doc.add(new Field(LuceneDocumentClips.title,
iter.next().getLexicalForm().trim(), Field.Store.NO, Field.Index.ANALYZED));
}
// and some more
}
with this method. Line (2) "after getLiterals" is never reached and jvm throws
a OutOfMemoryException (Heap space) right on getLiterals()
I changed the method on line (0) to:
protected void addToLuceneIndex(GraphNode clipNode) {
(0) GraphNode clip = new GraphNode(clipNode.getNode(),
this.getBundleGraph());
// the same stuff as before
...
...
}
and strangely it works!
Why in gods name can instatiating a new GraphNode (of a allready instatiated
node) fix a OutOfMemoryException?
even stranger - CommittableGraphNode fixes the issue as well :
protected void addToLuceneIndex(GraphNode clipNode) {
(0) CommittableGraphNode clip = new CommittableGraphNode
(clipNode.getNode(),new CommittableMGraph(new LockableMGraph(
this.getBundleGraph())));
// the same stuff as before
...
...
}
and just to make things more interessting. the following fixes it too.
protected void addToLuceneIndex(GraphNode clipNode) {
(0) GraphNode clip = new GraphNode (clipNode.getNode(),new
CommittableMGraph(new LockableMGraph( this.getBundleGraph())));
// the same stuff as before
...
...
}
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira