Hi there,

I have a question about a concurrency issue. I have 3 nodes A, B and C in 
the database. There is a lightweight edge from A to B. There is also an 
edge from C to B. Now I have 2 threads running concurrently, Thread 1 is 
deleting node A using OrientVertex.remove() function.  Thread 2 is deleting 
node C using OrientVertex.remove() function in the same time. Right now I 
am getting this error 

com.orientechnologies.orient.core.exception.OConcurrentModificationException: 
Cannot UPDATE the record #18:1 because the version is not the latest. 
Probably you are updating an old record or it has been modified by another 
user (db=v72 your=v71)

#18:1 is my node B. what would be the best practice to handle this? Should 
I do something like this in the thread?

OrientVertex b = graph.getVertex(#18:1);
b.lock(false);
OrientVertex a = graph.getVertex(id_of_A);
a.remove();
b.unlock();

When thread 1 called b.lock(false) and locked the vertex, what will happen 
if thread 2 calls b.lock(false)? does the call return an exception or the 
call will return when b is unlocked by thread 1?

Thanks,
Jing

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to