Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 98877 invoked from network); 25 Feb 2010 15:34:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Feb 2010 15:34:15 -0000 Received: (qmail 10825 invoked by uid 500); 25 Feb 2010 15:34:14 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 10796 invoked by uid 500); 25 Feb 2010 15:34:14 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 10789 invoked by uid 99); 25 Feb 2010 15:34:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Feb 2010 15:34:14 +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: domain of tmueller@day.com designates 207.126.148.88 as permitted sender) Received: from [207.126.148.88] (HELO eu3sys201aog102.obsmtp.com) (207.126.148.88) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 25 Feb 2010 15:34:05 +0000 Received: from source ([209.85.218.220]) by eu3sys201aob102.postini.com ([207.126.154.11]) with SMTP ID DSNKS4aYVzKMlCKwGDeY0nnwQ4ZEu7KqSsP8@postini.com; Thu, 25 Feb 2010 15:33:45 UTC Received: by bwz20 with SMTP id 20so3495544bwz.31 for ; Thu, 25 Feb 2010 07:33:43 -0800 (PST) MIME-Version: 1.0 Received: by 10.204.133.91 with SMTP id e27mr834487bkt.19.1267112022866; Thu, 25 Feb 2010 07:33:42 -0800 (PST) In-Reply-To: <4B869135.7060300@apache.org> References: <91f3b2651002241034l3c8495afk188b276f67437534@mail.gmail.com> <4B85860A.8090709@gmail.com> <91f3b2651002241219u415fa9a7qfde08ea3b1b5ea09@mail.gmail.com> <4B868DF2.5070407@gmail.com> <4B869135.7060300@apache.org> Date: Thu, 25 Feb 2010 16:33:42 +0100 Message-ID: <91f3b2651002250733j7159ea09gd27c72a51c97e111@mail.gmail.com> Subject: Re: [jr3] Synchronized sessions From: =?ISO-8859-1?Q?Thomas_M=FCller?= To: dev@jackrabbit.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hi, > this creates a big potential for deadlocks Could you provide an example on how such a deadlock could look like? > just synchronizing all methods > So you also synchronize all Node/Item/Property methods Some methods don't need to be synchronized, for example some getter methods such as Session.getRepository(), RangeIterator.getPosition() and getSize(). I'm not sure if Node.getProperty needs to be synchronized. The Value class is (almost) immutable so synchronization is not required here. But very likely Session.getNode(..) and Node.getNode() need to be synchronized because those potentially modify the cache. > ensure that for a given Item x, the same Item instance is always returned from all getXXX methods .... I'm not sure what you are referring to. Jackrabbit already does ensure the same node object is returned as far as I know, but for other reasons than synchronization. > if people do the wrong things, well, fine, let them do ... It's usually not those people that have to fix broken repositories. > my veto Let's see. > Most jcr apps I've seen often use a single session from several threads to read from this session. (I think I also read it somewhere that this is safe with jackrabbit, but I might be mistaken). I'm not sure if this is really safe. Maybe it is problematic if one thread uses the same session for updates. > Simply syncing everything on the session would decrease performance in these cases dramatically. Actually, I don't think that's the case. Regards, Thomas