Hi, Thanks for the quick and detailed reply! This mailing list is a great help.
I have a follow-up question: You say that Neo4j "will synchronize access between concurrent transactions (on a node and relationship level)". I am a bit curious about the granularity of the synchronization on the node/relationship level. Is every node an isolated resource in this sense? That is, if I modify properties of node A and properties of node B the modifications will not block each other? Even if they are connected with a relation? How about relations? Can modifying or creating a relation also lock either of the two nodes it connects? Best regards, Thomas On Wed, Feb 10, 2010 at 1:23 PM, Johan Svensson <jo...@neotechnology.com> wrote: > Hi, > > On Wed, Feb 10, 2010 at 10:48 AM, Thomas Andersson > <greddbul...@gmail.com> wrote: >> Hi, >> ... >> // don't do this >> synchronized void methodA() >> { >> nodeA.setProperty( "prop1", 1 ); >> methodB(); >> } >> >> synchronized void methodB() >> { >> nodeB.setProperty( "prop2", 2 ); >> } >> >> According to the test, "The code above is very deadlock prone when >> methods A and B are called concurrently.". >> >> Exactly why is that? I try to understand what the situation is that >> should be avoided, but when I run the code in my head I can't figure >> out when and why the deadlock occurs. > > All Neo4j API operations must be invoked within a transaction and the > modifying operations (such as Node.setProperty) will synchronize > access between concurrent transactions (on a node and relationship > level). I updated the wiki with a link to > http://wiki.neo4j.org/content/Transactions#Isolation that explains > this a bit better. > > To give you a deadlock scenario with the code above: > > - tx1 modifies nodeB > - tx2 calls methodB but blocks on nodeB.setProperty > - tx1 calls methodA and will then block when trying to call methodB > - deadlock that can not be detected by the Neo4j kernel > > Regards, > -Johan > _______________________________________________ > Neo mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user