<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jukka Zitting wrote:
<blockquote
cite="mid:510143ac0801161246m58e3a53rcbeb8f9154bc11e4@mail.gmail.com"
type="cite">
<pre wrap="">Hi,
On Jan 16, 2008 9:27 PM, Dan Diephouse <a class="moz-txt-link-rfc2396E" href="mailto:dan.diephouse@mulesource.com"><dan.diephouse@mulesource.com></a>
wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I have to lock the parent node before I can add child nodes? How does
that
help the situation? Then I have one thread that fails while the other
succeeds.
Lets say I have a node /spreadsheets and then I have two users using my web
interface and they both add a spreadsheet to the repository at the same
time. And spreadsheet nodes are represented by /spreadsheets/spreadsheet .
Are you saying thats not possible?
</pre>
</blockquote>
<pre wrap=""><!---->
Jackrabbit handles such concurrent additions nicely as long as the
added child nodes have separate names. See JCR-584 [1] for the
details.
Unfortunately this does not currently work with same name siblings. If
I recall correctly there were some tricky semantic issues on how such
cases should really be handled.
Have you considered not using same name siblings in your content mode.
See [2] and the related mailing list thread [3] for a rationale why
locally (within a parent) unique node names are considered a better
solution.
</pre>
</blockquote>
Thanks. Follow up question: My data has no unique id or anything
associated with it. So I'm going to have to generate an id then.<br>
<br>
I can do an increment type thing like this:<br>
<br>
public Node getNode(int nodeName, Node parent) {<br>
try { return parent.addNode(new Integer(nodeName).toString()) }<br>
catch (ItemExistsException e) { return getNode(nodeName+1); }<br>
}<br>
<br>
Lets say I have two open transactions where this is occurring at the
same time. Will Tx#2 see that #1 has added a node named "1" and get an
ItemExistsException even though I haven't committed Tx#1?<br>
<br>
Are there any bundled utilities within jackrabbit that can create
unique ids across a cluster? Should I just use UUIDs?<br>
<br>
- Dan<br>
<pre class="moz-signature" cols="72">--
Dan Diephouse
MuleSource
<a class="moz-txt-link-freetext" href="http://mulesource.com">http://mulesource.com</a>
| <a class="moz-txt-link-freetext" href="http://netzooid.com/blog">http://netzooid.com/blog</a></pre>
</body>
</html>
|