jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: Usage of Node lock()
Date Sat, 09 Oct 2010 19:38:57 GMT
Hi,

On Sat, Oct 9, 2010 at 12:50 PM, Markus Blaurock <blaurock@dig.de> wrote:
> In which cases should i use Node.lock()?

The locking feature in JCR is designed with document- and
workflow-level locking in mind more than fine-grained thread or
process synchronization. Think of it as a way to guarantee exclusive
write access while an author has a document open in an editing tool.

Typical time scales for such locks range from seconds to days. For
longer locks (months to years) you'd typically use the retention
feature, and shorter locks (sub-second range) are best handled using
lower level synchronization mechanisms available on your platform.

Sometimes it's necessary to bend these guidelines, for example when an
external sub-second synchronization mechanism is not available or
appropriate. Even though you can often achieve your use cases also
with JCR locking in these cases, the performance or other
characteristics of such solutions are seldom optimal.

> 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.

Exactly.

> 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?

Yes.

BR,

Jukka Zitting

Mime
View raw message