hi cédric

On 11/10/05, Cédric Damioli <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm playing with multi-threaded stuff (SVN trunk from less than 10
> minutes).
>
> Let suppose that two different threads acquire a Session, then get the
> same Node X and then add a new child to this Node, and then call the
> save() method.
>
> First save() call will success, and second one will lead to :
> javax.jcr.InvalidItemStateException:
> b13b8065-5115-4bd3-87cf-5544879209e8: the item cannot be saved because
> it has been modified externally.
> The given UUID being the actual UUID of the Node X.
> I assume this behaviour is ok, isn't it ?

correct.

>
> But, second step, just before calling the method save(), I call
> session.refresh(true), and what I'm getting is not what I was expecting :
> firstly, the InvalidItemStateException is here again
> and secondly, after debugging, it appears that the refresh(true) doesn't
> behave as expected : after the second call to refresh(true), the second
> Sessions does not know (according to itemExists()) the first child
> created by the first Session.
>
> My code is equivalent to :
>
> Node X = session.getNode(path);
> X.addNode(whateverUniqueName);
> session.refresh(true);
> session.save();
>
>
> Do I misunderstood the refresh() method ? Or is there a bug here ?

the current behaviour of refresh=true is according to the spec. the spec
does not mandate to merge changes made by different sessions on the
*same* item, in your case parent node.

cheers
stefan

>
> Regards,
>
> --
> Cédric Damioli
> ANYWARE TECHNOLOGIES
> Tel : +33 (0)5 61 00 52 90
> Fax : +33 (0)5 61 00 51 46
> http://www.anyware-tech.com
>
>

Reply via email to