Re: [Neo4j] lock or not?

2011-09-14 Thread Linan Wang
Got it. i really appreciate your help. On Wed, Sep 14, 2011 at 11:14 PM, McKinley wrote: > I mean that if you are not running the REST server or high availability then > you can assume that even if you only put the read lock in the Java > thread/object world, the database will not change. No othe

Re: [Neo4j] lock or not?

2011-09-14 Thread McKinley
I mean that if you are not running the REST server or high availability then you can assume that even if you only put the read lock in the Java thread/object world, the database will not change. No other process exists that could change it. You do not need to bother with a read lock in the database

Re: [Neo4j] lock or not?

2011-09-14 Thread Linan Wang
McKinley Thank you very much for the detailed explanation. however, I don't get the part about "only one JVM will access database". neo4j doesn't support multiple JVMs has write access to the same db, right? On Wed, Sep 14, 2011 at 9:14 PM, McKinley wrote: > If a second thread reads that there is

Re: [Neo4j] lock or not?

2011-09-14 Thread McKinley
If a second thread reads that there is no node with external_id 123 in between the time that a first thread finds no node and elects to create it, you will get 2 nodes with external_id 123. So yes, you need to introduce a lock and synchronize. You can create read locks in the graph database but yo

[Neo4j] lock or not?

2011-09-14 Thread Linan Wang
hi all, I have implemented a function UserFactory.get_or_create_with_external_id(long external_id). the function basically search the index, see if a node already created and has the property "external_id" equals to external_id. if there is such a node, return, if not, create one, assign property a