Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 26646 invoked from network); 9 Oct 2010 10:51:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 9 Oct 2010 10:51:17 -0000 Received: (qmail 18297 invoked by uid 500); 9 Oct 2010 10:51:17 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 18029 invoked by uid 500); 9 Oct 2010 10:51:14 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 18020 invoked by uid 99); 9 Oct 2010 10:51:13 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Oct 2010 10:51:13 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [195.238.142.64] (HELO smtpgw00.dig.de) (195.238.142.64) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 09 Oct 2010 10:51:04 +0000 Received: (qmail-ldap/ctrl 8463 invoked from network); 9 Oct 2010 10:50:43 -0000 Received: from dipb110238.dig-prov.de (HELO [192.168.2.100]) (markus@blaurocks.de@[195.238.136.238]) (envelope-sender ) by smtpgw00.dig.de (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 9 Oct 2010 10:50:43 -0000 Message-ID: <4CB048FB.9020404@dig.de> Date: Sat, 09 Oct 2010 12:50:35 +0200 From: Markus Blaurock User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: users@jackrabbit.apache.org Subject: Usage of Node lock() Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org 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? regards, markus