On 12/01/18 11:37, George News wrote:
Hi,

I would like to know how transactions are handle over an RDFConnection
to a local dataset.

Jena ships with source code.

You can read the source code and/or write a little app and trace its execution.

When using directly the dataset, you pointed that it doesn't matter if
you user a static instance or not for storing the dataset, as Txn
internally manages and handle everything. In this sense you recommended
using a static instance. Is it the same for RDFConnection or are
transactions linked to the instance?

RDFConnectionLocal uses Txn on the dataset it is wrapping.

It depends on the dataset, not the RDFConenction which is pure code (and an unused member).

The issue here is if 1) and 2) behaves similarly when multitheaded calls
to Txn are done. Are both methods blocking access to the dataset? Or is
case 1) only blocking on the instance of the connection and multiple
simultaneous call will led to error?

Transactions are whatever the dataset provides - for TDB that's multiple read-and-singlewriter (MR+SW) all at the same time.


Thanks for your help
Jorge

1) Per call connection
try ( RDFConnection conn = RDFConnectionFactory.connect(...) ) {
     Txn.execWrite(conn, ()-> {
        // Whatever
     }) ;
}

2) Static instance

public static RDFConnection conn = RDFConnectionFactory.connect(...);

// ....

// In a method
Txn.execWrite(conn, ()-> {
    // Whatever
}) ;


Reply via email to