jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Damioli <cedric.dami...@anyware-tech.com>
Subject Wrong behaviour with session.refresh(true)
Date Thu, 10 Nov 2005 19:59:31 GMT
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 ?

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 ?

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


Mime
View raw message