You cannot nest transactions nor can you promote a read to a write.
You need to rewrite your code or use txn which correctly checks if a 
transaction is available and if not will begin the correct one, either READ or 
WRITE.


Dick
-------- Original message --------From: George News <[email protected]> Date: 
27/12/2017  10:27  (GMT+00:00) To: Jena User Mailing List 
<[email protected]> Subject: Txn code not handling type of transaction 
Hi,

As you know from other threads I'm having some issues with transactions.
Your suggestion is to use Txn instead of begin/end. Just for curiosity I
have checked the Txn code at [1] and it seems that inside you use begin/end.

However I have a doubt concerning how you handle the begin/end for READ
and WRITE. It seems that you open a transaction based on
txn.isInTransaction(), but how do you know if it is a READ or WRITE?

If you create something like:

Txn.executeRead(dataset, {
    Txn.executeWrite(dataset, {
       // Whatever
    }   
  }
}

the txn.begin(ReadWrite.WRITE) is not called and therefore it might be
leading to unexepected behaviours for the txn.commit().

could you give some hints on how this is handle internally? Before fully
modify the code I have, it might be easier to replicate the txn
behaviour ;) but I would like to know the above (if possible).

As always, thanks in advanced
Jorge

[1]: jena/jena-arq/src/main/java/org/apache/jena/system/Txn.java

Reply via email to