I have an application built on top of neo4j using the java api for v3.0.1. It requires finding a "top" node first at the beginning of every one of my
graph operations. This top node serves as the start of my graph db. I noticed an earlier edition of neo4j used a
reference node from which to retrieve the graph. Since that apparently is no longer a feature in newer releases,
I chose to label this top node with a "TOP" label, and then simply retrieve this node using findNode method. Now, this method works
great so long as the testing is done in a single thread. However, when used in multiple threads, it occasionally gets a
MultipleFoundException thrown when invoking this findNode method. I feel quite certain that my code only creates one top
node at a time, and whenever it creates a new top node, it deletes the old top node and always does so within a single transaction block.
However, if findNodes() is used instead, I find that two nodes can be counted by iterating through the ResourceIterator (with hasNext/getNext).
(Although I'm not sure if they are both viable active nodes.)
Is this the best technique for maintaining such a single top node? Or is there a more preferred way?
Does the ResourceIterator that is returned ever contain outdated entries? (I notice the javadocs for this class is missing.)
I would appreciate any ideas you may have on this.
Thanks again.
David Starkweather