You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Dan Connelly <ds...@adelphia.net> on 2006/11/17 16:32:52 UTC

Multiple sessions updating the same workspace

I want to implement code where one JVM Thread had multiple Sessions, 
each of which updates the same Workspace.

Each session has its own sub-tree under the root node.   There will be 
no updates that conflict (logically).    There may be hanging references 
(briefly) but these will be handled gracefully.

Each Session will save it state once in turn (serially) after the last 
state change .   After the last Session has done its save, then there 
will be a remaining single Session that will resolve paths into 
references across the entire Workspace.   That is the first place that 
complete visibility of all updates is needed.   Partial updates (thus, 
hanging references) are a pain but will be handled gracefully.   There 
will be no Transactions and no Locking.

What are the conditions (if any) that would prevent any one of these 
Sessions from executing its save?

Does this change if each Sessions runs in its own Thread?   In this 
case, it may not be possible to determine that state changes are 
globally complete across the set of sessions.

       -- Dan Connelly

Re: Multiple sessions updating the same workspace

Posted by Marcel Reutegger <ma...@gmx.net>.
Dan Connelly wrote:
> What are the conditions (if any) that would prevent any one of these 
> Sessions from executing its save?

I'm not sure I understand the the usage you described correctly, so I just state 
all the conditions that come to my mind:

- an ancestor of the an item in the change set is locked
- multiple change sets intersect (in a conflicting way) and are saved concurrently
- access rights were modified between a transient change and the corresponding 
save call (e.g. resulting in a transient change which is not permitted anymore).
- referential integrity is broken
- in case of XA: TM decides to rollback the changes
- a persistence manager fails to save the change set with an exception

(did I miss anything?)

> Does this change if each Sessions runs in its own Thread?

You shouldn't use a session instance with multiple threads anyway. So, one 
thread per session is the default use case.

regards
  marcel