You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Qi He <he...@gmail.com> on 2014/03/08 17:02:23 UTC
Jena transactions vs lock
Hello,
When should use a lock on a dataset vs. a transaction? What about with
models? Are locks necessary then? Will there be inconsistencies when
dealing with persistent models when updating them from two separate threads?
Re: Jena transactions vs lock
Posted by Andy Seaborne <an...@apache.org>.
On 08/03/14 16:02, Qi He wrote:
> Hello,
>
> When should use a lock on a dataset vs. a transaction? What about with
> models? Are locks necessary then? Will there be inconsistencies when
> dealing with persistent models when updating them from two separate threads?
>
Use transactions unless you want some special effect or other.
Transaction allow multiple readers AND a single writer at the same time.
Pure locking only give multiple readers OR a single writer.
And transaction are crash resistant.
If you want multiple threads inside one transaction, you then need to do
locking as well - the thread doing the .begin must be the one to do the
.commit./.end.
Andy