Return-Path: Delivered-To: apmail-incubator-jackrabbit-dev-archive@www.apache.org Received: (qmail 42986 invoked from network); 11 Aug 2005 11:46:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 11 Aug 2005 11:46:06 -0000 Received: (qmail 56971 invoked by uid 500); 11 Aug 2005 11:46:05 -0000 Mailing-List: contact jackrabbit-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-dev@incubator.apache.org Received: (qmail 56958 invoked by uid 99); 11 Aug 2005 11:46:05 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2005 04:46:05 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [83.65.204.219] (HELO itchy.tm1.at) (83.65.204.219) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2005 04:46:26 -0700 Received: from localhost (localhost [127.0.0.1]) by itchy.tm1.at (Postfix) with ESMTP id BEA4930FD46 for ; Thu, 11 Aug 2005 12:20:09 +0200 (CEST) Received: from [192.168.40.101] (83-64-161-207.finon.xdsl-line.inode.at [83.64.161.207]) by itchy.tm1.at (Postfix) with ESMTP id DE0E930CDC9 for ; Thu, 11 Aug 2005 12:20:06 +0200 (CEST) Message-ID: <42FB3A72.9030509@ingen.at> Date: Thu, 11 Aug 2005 13:45:54 +0200 From: Walter Raboch Organization: ingen User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: jackrabbit-dev@incubator.apache.org Subject: Re: concurrency problem References: <42F4DEFB.4090605@ingen.at> <6.1.1.1.2.20050808120000.01a20860@hermes.ulaval.ca> <90a8d1c0050808100817be4221@mail.gmail.com> <42F9EBC0.40104@ingen.at> <90a8d1c00508100647398ae5a7@mail.gmail.com> In-Reply-To: <90a8d1c00508100647398ae5a7@mail.gmail.com> Content-Type: multipart/mixed; boundary="------------060207020700080007030601" X-Virus-Scanned: by AMaViS 0.3.12pre8 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------060207020700080007030601 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Hi Stefan, >>Thanks for the discussion. Now I unterstand jackrabbits way of doing. >>But in my opinion adding child nodes should not alter the parent node >>itself. Just changing some properties is a state change. > > i don't agree. see 7.1.4 Adding Nodes in the jsr 170 spec: > > In order to save a newly added node, save must be called either on the > Session, or on the new node's parent or higher-order ancestor > (grandparent, etc.). > >>Furthermore there should be an error just in the case, that both updates >>overwrite the changes of the other -> to prevent lost update problems. >>In my example code it�s not the case, so I would prefer no error at all. >>What do you think? > > AFAIK lost updates did never happen. your testcase failed in the right > situations > but threw the wrong exceptions. i committed a fix for that problem yesterday. > IMO it now works as it should according to the jsr 170 spec. You are right according to the spec. Let me try to explain my thoughts: s0: read root node s1: read root node s0: add or remove child "c1" s1: add or remove child "c2" s0: rn.save() s1: rn.save() All this without error. Because the changes of both sessions dont interfere. If both sessions change the same child or attribute, there should be thrown an InvalidItemStateException. s0: read root node s1: read root node s0: set property p="hello" s1: set property p="world" s0: save s1: save -> InvalidItemStateException What do you think? To our first problem with my testcase. I rerun the code but it still fails with ItemNotFoundExceptions. But I dont know why. cheers, Walter -- Output of rerun (revision 231423): ================================== s0: started. s1: started. s2: started. s3: started. s4: started. s3: Exception: removing testnode javax.jcr.InvalidItemStateException: /: the item cannot be saved because it has been modified externally. at org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:347) at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205) at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:747) at TestSession.run(TestSession.java:62) at java.lang.Thread.run(Unknown Source) s3: ended. javax.jcr.ItemNotFoundException: 545ab69b-0297-427c-a05a-217e3c8f7d88 at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:498) at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:349) at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:781) at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:725) at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:672) at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1721) at TestSession.run(TestSession.java:70) at java.lang.Thread.run(Unknown Source) s0: Exception: adding testnode s0: ended. s4: Exception: removing testnode javax.jcr.InvalidItemStateException: /: the item cannot be saved because it has been modified externally. at org.apache.jackrabbit.core.ItemImpl.getTransientStates(ItemImpl.java:347) at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1205) at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:747) at TestSession.run(TestSession.java:62) at java.lang.Thread.run(Unknown Source) s4: ended. s1: Exception: adding testnode javax.jcr.ItemNotFoundException: e170d490-b7c1-4dfa-be14-f8932162b9f7 at org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager.java:498) at org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:349) at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:781) at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:725) at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:672) at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1721) at TestSession.run(TestSession.java:70) at java.lang.Thread.run(Unknown Source) s1: ended. ..........s2: ended. --------------060207020700080007030601--