You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Kadir Alaca <al...@web.de> on 2014/06/12 19:29:41 UTC

Atomic path creation

Hello,

I'm creating nested node structures in a concurrent environment.

The structure looks like the following:

..
../myitems/2014/06/12/18/50/07/063/fancyItemWithUniqueName1/..
../myitems/2014/06/12/18/50/07/066/fancyItemWithUniqueName2/..
../myitems/2014/06/12/18/50/07/069/fancyItemWithUniqueName3/..
../myitems/2014/06/12/18/50/07/072/fancyItemWithUniqueName4/..
../myitems/2014/06/12/18/50/07/073/fancyItemWithUniqueName5/..
../myitems/2014/06/12/18/50/07/083/fancyItemWithUniqueName6/..
../myitems/2014/06/12/18/50/07/237/fancyItemWithUniqueName7/..
../myitems/2014/06/12/18/50/07[2]/064/fancyItemWithUniqueName8/..
..

All items are from node type NodeType.NT_UNSTRUCTURED.

As you can see a portion of the path is created from time in milliseconds.
The reason for nesting the nodes as shown is to optimize retrieval performance.

What bothers me is the SNS in the created node structure, e.g. in the path of fancyItemWithUniqueName8.

Until the session is saved i have not full information whether a node already exist or not.

Since this is in a concurrent environment with a session per thread,
how can i create structures like the above without SNS?


Regards,
Kadir


Re: Atomic path creation

Posted by Lukas Kahwe Smith <sm...@pooteeweet.org>.
On 12 Jun 2014, at 19:29, Kadir Alaca <al...@web.de> wrote:

> Hello,
> 
> I'm creating nested node structures in a concurrent environment.
> 
> The structure looks like the following:
> 
> ..
> ../myitems/2014/06/12/18/50/07/063/fancyItemWithUniqueName1/..
> ../myitems/2014/06/12/18/50/07/066/fancyItemWithUniqueName2/..
> ../myitems/2014/06/12/18/50/07/069/fancyItemWithUniqueName3/..
> ../myitems/2014/06/12/18/50/07/072/fancyItemWithUniqueName4/..
> ../myitems/2014/06/12/18/50/07/073/fancyItemWithUniqueName5/..
> ../myitems/2014/06/12/18/50/07/083/fancyItemWithUniqueName6/..
> ../myitems/2014/06/12/18/50/07/237/fancyItemWithUniqueName7/..
> ../myitems/2014/06/12/18/50/07[2]/064/fancyItemWithUniqueName8/..
> ..
> 
> All items are from node type NodeType.NT_UNSTRUCTURED.
> 
> As you can see a portion of the path is created from time in milliseconds.
> The reason for nesting the nodes as shown is to optimize retrieval performance.
> 
> What bothers me is the SNS in the created node structure, e.g. in the path of fancyItemWithUniqueName8.
> 
> Until the session is saved i have not full information whether a node already exist or not.
> 
> Since this is in a concurrent environment with a session per thread,
> how can i create structures like the above without SNS?

you can for one create a new node type that disables SNS. this will then give you an error instead though which you could then handle by trying another name. you can also reduce the likely hood by adding another random string.


regards,
Lukas Kahwe Smith
smith@pooteeweet.org