On 6/20/06, Torgeir Veimo <[EMAIL PROTECTED]> wrote:
> I copy&pasted that code into mine, and run the testSequence code on am > empty repository. I made some slight changes, and now that code gives > the same exceptions. Notice how I changed retrieving the session and the > lack of session logout.
I see. Now I understand why you get the exception. You have multiple threads using the same session instance. This is not permitted. See section 7.5 of the spec. The reason why you get the exception is: one thread locks the node which results in adding two properties: jcr:lockOwner and jcr:lockIsDeep. This also results in a modification of the counter node. Now when another thread (using the same session instance) at the same time tries to lock the node it will see pending changes and throw an exception.
I can confirm that if my getNewResourceId() uses it's own session that it closes after retrieving the counter value, it works. The lock code should ideally work with the samme session being reused?
well, you can reuse the session, but you must not shared it among multiple threads. Unless you synchronize access to the session. regards marcel
