jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Doubleday <daniel.double...@gmx.net>
Subject Best practice for working with multiple sessions needed
Date Sun, 24 Sep 2006 13:05:41 GMT

Hi all,

The problem scenario is concurrent application (web)

The following pseudo code tries to explain the general problem:

// thread a
Node userANode = userASession.getRootNode().getNode("somenode");

// thread b
Node userBNode = userBSession.getRootNode().getNode("somenode");

// thread a
userANode.addNode("foo");

// thread b
userBNode.addNode("bar");

// thread a
userANode.save();

//thread b
userBNode.save();
// crash

Since the node "somenode" was modified in two sessions the thread that tries
to do the second save will fail because of the "external" modification.

1. my main problem is that I don't see an easy way of how to recover from
such a crash. I don't even see a way to check first because ItemState is
jackrabbit internal
2. I believe that in almost every webapp adding a node to some special entry
node (such as a folder for messages) is very common. 
3. using a shared session does not seem to be an option (synch issue)

Is there some sort of best practice working with multiple sessions? Does
this mean that one has to implement an application specific locking
mechanism? 

Cheers, Daniel



-- 
View this message in context: http://www.nabble.com/Best-practice-for-working-with-multiple-sessions-needed-tf2326328.html#a6471987
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message