jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Villegas <...@uniscope.jp>
Subject Re: ItemStateException
Date Mon, 27 Feb 2006 09:57:12 GMT
Hmmm... We had problems before because the application didn't close the 
sessions on exit and the RMI client leaves them open on the server even 
though the client VM exits. We may still have session leakage.
Shouldn't the RMI server close sessions if the client dies, or there's 
no way to know that a client has died?

Thanks for the explanation!

Carlos

Stefan Guggisberg wrote:
> On 2/27/06, Carlos Villegas <cav@uniscope.jp> wrote:
> 
>>What does the following exception mean:
>>
>>javax.jcr.InvalidItemStateException:
>>d35eb7b6-ca1a-4c18-98fc-0aa0ee9b8987: the item cannot be saved because
>>it has been modified externally.
>>
>>There's only one application using the repository. What could be happening?
> 
> 
> this exception indicates that you have 2 separate sessions that try to modify
> the *same* item.
> 
> the following code fragment illustrates this:
> 
> Node a1 = session1.getRootNode().getNode("a");
> Node a2 = session2.getRootNode().getNode("a");
> 
> // session 1 modifies node a
> a1.addNode("b");
> // session 2 modifies node a
> a2.addNode("c");
> 
> // session 1 saves its changes
> a1.save();
> 
> // session 2 tries to save its changes but gets
> // an InvalidItemStateException because its
> // changes have become stale
> a2.save();   // throws
> 
> 
> you can avoid such situations if you lock the node before
> you start modifiying it.
> 
> cheers
> stefan
> 
> 
>>Carlos
>>
> 
> 


Mime
View raw message