jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Guggisberg <stefan.guggisb...@gmail.com>
Subject Re: concurrency problem
Date Wed, 10 Aug 2005 13:47:00 GMT
hi walter,

On 8/10/05, Walter Raboch <wraboch@ingen.at> wrote:
> Hi Stefan,
> 
> > the correct beahviour should be:
> >
> > s0 : Read the rootNode
> > s1 : Read the rootNode
> > s0 : Modify rootNode : remove testnode-s0
> > s1 : Modify rootNode : remove testnode-s1 & save() -->ERROR the rootNode
> 
>   there should be no error at this point, s0 has not been saved yet.

absolutely correct, i haven't been careful enough when i copy/pasted it,
sorry for that. let me try again;)

s0 : Read the rootNode
s1 : Read the rootNode
s0 : Modify rootNode : remove testnode-s0
s1 : Modify rootNode : remove testnode-s1
s0 : save()
s1 : save() -->InvalidItemStateException since the root node has been externally
     modifiied (by s0); s1's 'copy' has become stale as a result

> 
> > s0 : save()
> 
>   now there should be an error since s1 saved its state before
> 
> > s1 : save() -->InvalidItemStateException since the root node has been externally
> >       modifiied (by s0) is has s1's 'copy' has become stale as a result
> 
>   I dont think that here should be an error, since the last saved
> (commited) version  of the rootNode is from s1 and the changes from s0
> has not been valid and not commited. so the nodes state has not changed.
> 
> > we'll fix that asap.
> 
> 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:
<quote>
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.).
</quote>

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

cheers
stefan

> 
> cheers,
> Walter
> 
>

Mime
View raw message