jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Blaurock <blaur...@dig.de>
Subject Usage of Node lock()
Date Sat, 09 Oct 2010 10:50:35 GMT
Hello all,

after chasing some problems in our code a basic question about the usage
of Node.lock() occured to me:

In which cases should i use Node.lock()?

Currently i lock a node just before i change some properties /
child-nodes and directly calling save() afterwards.

After studying the source-code of jackrabbit it seems to me, that this
usage is obsolete in JCR. It's not necessary to lock the node, because
the session.save() operation commits all changes atomically with one
write-lock in the SISM.

So: Node.lock() is something i would use to lock a node for a _longer_
timespan e.g. if i have long running sessions accumulating many user
actions. ---  locking just before storing my changes it is useless.

Even more, a lock operation involves some kind of write-operation on the
repository (lock-property?), so i am putting unnecessary load on my
machine when locking the node.

Am i correct?


View raw message