AnsweredAssumed Answered

Transactions and read/write property

Question asked by calle on Jan 20, 2009
Latest reply on Jan 22, 2009 by lotharm
I have a scenario where nodeService.getProperty() and nodeService.setProperty() for the same property on the same node is executed inside a RetryingTransactionCallback:

final RetryingTransactionHelper trxHelper = transactionService.getRetryingTransactionHelper();
return trxHelper.doInTransaction(new RetryingTransactionCallback<NodeRef>() {
   public NodeRef execute() throws Throwable {
      final int v = nodeService.getProperty(nodeRef, qName);
      nodeService.setProperty(nodeRef, qName, v + 1);

In this example the property is a simple value that is incremented by one.

Now, if one client is accessing this property while it is updated by another does the transaction work like a mutex? I would expect it to do so but I find very little documentation about the TransactionService and nothing about how simultaneous access is handled. What I want to avoid is that the property is updated by one client and another client access the property before the new value has be set.

Any TransactionService master out there that could explain this to me?