jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Multithreading/Mutliuser(?) access
Date Fri, 21 Oct 2005 11:34:22 GMT
Eugeny N Dzhurinsky wrote:
> okay... but right now when trying to access node from several concurrent
> threads within the same session, these methods throws exception 
> Node already locked: /random/node1_3/node2_3

please note that you should not use multiple write threads on a single 
session because that's something that is not supported (or even 
prohibited?) by JTA, and as a consequence jackrabbit does not take 
precausions for such a case!
what jackrabbit supports are multiple threads just reading from a single 
session.

> current.lock(true, true);
> current.setProperty("test", propertyValue);
> current.save();
> current.unlock();
> 
> So I assume I should synchronize access to node in my code, right? JackRabbit
> won't just wait when node is released?

this is not a question whether jackrabbit does it some way. the jcr spec 
says that an an exception is thrown when a lock cannot be aquired!

in the end that means you have to synchronize access in you own code or 
write / use  a little utility that implements a blocking Node.lock()

we had a thread about this topic some time ago, see: 
http://thread.gmane.org/gmane.comp.apache.jackrabbit.devel/2661

regards
  marcel

Mime
View raw message