public class TxnDataset2Graph extends TransactionalLock
Transactional that passes the transaction operations down to transactions on
independent graphs.
There are limitations:
Transactional maintains a MRSW policy because that is all that is
required of graphs in general.
DatasetGraphOne) where the one
graph is an InfGraph and should work when the graphs in the dataset is not changing or
when a new memory graph is added mid-transaction.
This is not "nested transactions" - there is no overall "commit" or "abort". If failure/restart occurs, some graphs may have committed and others not. It is the best that can be done given for an arbitrary collection of graphs, backed by different storage and having different capabilities.
Best practice is to change the graph membership outside of any transaction, ideally at setup time of the object using this class. (Caution: SPARQL Update can create graphs.)
DatasetGraphMapLink,
DatasetGraphOneTransactional.Promote| Constructor and Description |
|---|
TxnDataset2Graph(Graph primaryGraph,
Graph... otherGraphs) |
| Modifier and Type | Method and Description |
|---|---|
void |
abort()
Abort a transaction - finish the transaction and undo any changes (if a "write" transaction)
|
void |
addGraph(Graph graph) |
void |
begin(TxnType type)
Start a transaction.
READ or WRITE transactions start in that state and do not change for the lifetime of the transaction. |
void |
commit()
Commit a transaction - finish the transaction and make any changes permanent (if a "write" transaction)
|
void |
end()
Finish the transaction - if a write transaction and commit() has not been called, then abort
|
void |
removeGraph(Graph graph) |
void |
setPrimaryGraph(Graph graph) |
begin, create, createMRPlusSW, createMRSW, createMutex, isInTransaction, isTransactionMode, promote, transactionMode, transactionTypeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbegin, promotepublic void addGraph(Graph graph)
public void removeGraph(Graph graph)
public void setPrimaryGraph(Graph graph)
public void begin(TxnType type)
TransactionalWRITE: this guarantees a WRITE will complete if commit() is
called. The same as begin(ReadWrite.WRITE).
READ: the transaction can not promote to WRITE,ensuring read-only
access to the data. The same as begin(ReadWrite.READ).
READ_PROMOTE: the transaction will go from "read" to "write" if an
update is attempted and if the dataset has not been changed by another write
transaction. See also Transactional.promote().
READ_COMMITTED_PROMOTE: Use this with care. The promotion will
succeed but changes from other transactions become visible.
begin). If READ_PROMOTE, the dataset must not have
changed; if READ_COMMITTED_PROMOTE any intermediate changes are
visible but the application can not assume any data it has read in the
transaction is the same as it was at the point the transaction started.
This operation is optional and some implementations may throw
a JenaTransactionException exception for some or all TxnType values.
See Transactional.begin(ReadWrite) for a form that is required of implementations.
begin in interface Transactionalbegin in class TransactionalLockpublic void commit()
Transactionalcommit in interface Transactionalcommit in class TransactionalLockpublic void abort()
Transactionalabort in interface Transactionalabort in class TransactionalLockpublic void end()
Transactionalend in interface Transactionalend in class TransactionalLockLicenced under the Apache License, Version 2.0