Hi Marcel
Many thanks for the reply.
Sorry should've made things clearer.
The "nt:folder" nodes are added to the root node. We then add further
"nt:folder" nodes hanging off these nodes, and then a mixture of other
nodes (e.g. "jcr:content"). E.g:-
root
folder1
sub-folder1
content1
content2
sub-folder2
content1
content2
folder2
........
Regards
George
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcel
Reutegger
Sent: 15 January 2010 14:46
To: dev
Subject: Re: Jackrabbit Multi Threading Issue
Hi,
On Fri, Jan 15, 2010 at 14:02, <[email protected]> wrote:
> Hi
>
> I'm using jackrabbit in a multi-threaded application.
>
> I have used ThreadLocal to confine the Jackrabbit Session to a single
> thread and see no issues executing simultaneous threads except the
> following
> scenario:-
>
> - I want to create one node of type "nt:folder" and then have child
> nodes creating under it.
> - I attempt to get the node (of type "nt:folder") first.
> - If I receive PathNotFoundException, then I create the node (of type
> "nt:folder") and save the session.
> - Some threads create extra nodes of the same name although the node
exists?
>
> I've tried quite a few synchronization strategies, but no success. I
> haven't tried node locking.
what's the type of the parent node where the threads will create
nt:folder nodes?
it seems that the node type allows same name sibling child nodes.
but even if you changed that you may run into another exception. after
trying to get a node and catching the PathNotFoundException, another
thread may have created the node meanwhile. so you probably have to
catch another exception: ItemExistException when trying to add the
folder node and saving it. that's kind of ugly, but will probably work.
otherwise you should use locking.
regards
marcel
> Any help would be appreciated.
>
> Regards
>
> George Sibley