Class Transaction
- java.lang.Object
-
- org.apache.jena.dboe.transaction.txn.Transaction
-
- All Implemented Interfaces:
TransactionInfo
public final class Transaction extends java.lang.Object implements TransactionInfo
A transaction as the composition of actions on components. Works in conjunction with the TransactionCoordinator to provide the transaction lifecycle.- See Also:
TransactionCoordinator,TransactionalComponent
-
-
Constructor Summary
Constructors Constructor Description Transaction(TransactionCoordinator txnMgr, TxnType txnType, ReadWrite readWrite, TxnId txnId, long dataVersion, java.util.List<org.apache.jena.dboe.transaction.txn.SysTrans> components)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()voidbegin()voidcommit()voidend()voidensureWriteTxn()Require a WRITE transaction - includes trying to promote.longgetDataVersion()Each transaction is allocated a serialization point by the transaction coordinator.ReadWritegetMode()What mode is this transaction? This may change fromREADtoWRITEin a transactions lifetime.TxnStategetState()The transaction lifecycle stateTxnIdgetTxnId()Get the transaction id for this transaction.TxnTypegetTxnType()What type is this transaction? This is the initial TxnType and does not change during a transaction's lifetime.booleanhasFinalised()Has the transaction gone through all lifecycle states?booleanhasFinished()Has the transaction finished (has commit/abort/end been called)?booleanhasStarted()Has the transaction started?booleanisActiveTxn()Is this a view of a transaction that is active? Equivalent togetState() != INACTIVEbooleanisReadTxn()Is this a READ transaction? Convenience operation equivalent to(getMode() == READ)booleanisWriteTxn()Is this a WRITE transaction? Convenience operation equivalent to(getMode() == WRITE)voidnotifyUpdate()voidprepare()booleanpromote()booleanpromote(boolean readCommitted)voidrequireWriteTxn()Require a WRITE transaction - do not try to promote.
-
-
-
Constructor Detail
-
Transaction
public Transaction(TransactionCoordinator txnMgr, TxnType txnType, ReadWrite readWrite, TxnId txnId, long dataVersion, java.util.List<org.apache.jena.dboe.transaction.txn.SysTrans> components)
-
-
Method Detail
-
getState
public TxnState getState()
Description copied from interface:TransactionInfoThe transaction lifecycle state- Specified by:
getStatein interfaceTransactionInfo
-
getDataVersion
public long getDataVersion()
Each transaction is allocated a serialization point by the transaction coordinator. Normally, this is related to this number and it increases over time as the data changes. Two readers can have the same serialization point - they are working with the same view of the data.- Specified by:
getDataVersionin interfaceTransactionInfo
-
begin
public void begin()
-
promote
public boolean promote()
-
promote
public boolean promote(boolean readCommitted)
-
notifyUpdate
public void notifyUpdate()
-
prepare
public void prepare()
-
commit
public void commit()
-
abort
public void abort()
-
end
public void end()
-
requireWriteTxn
public void requireWriteTxn()
Require a WRITE transaction - do not try to promote.
-
ensureWriteTxn
public void ensureWriteTxn()
Require a WRITE transaction - includes trying to promote.
-
hasStarted
public boolean hasStarted()
Description copied from interface:TransactionInfoHas the transaction started?- Specified by:
hasStartedin interfaceTransactionInfo
-
hasFinished
public boolean hasFinished()
Description copied from interface:TransactionInfoHas the transaction finished (has commit/abort/end been called)?- Specified by:
hasFinishedin interfaceTransactionInfo
-
hasFinalised
public boolean hasFinalised()
Description copied from interface:TransactionInfoHas the transaction gone through all lifecycle states?- Specified by:
hasFinalisedin interfaceTransactionInfo
-
getTxnId
public TxnId getTxnId()
Description copied from interface:TransactionInfoGet the transaction id for this transaction. Unique within this OS process (JVM) at least .- Specified by:
getTxnIdin interfaceTransactionInfo
-
getTxnType
public TxnType getTxnType()
Description copied from interface:TransactionInfoWhat type is this transaction? This is the initial TxnType and does not change during a transaction's lifetime.- Specified by:
getTxnTypein interfaceTransactionInfo
-
getMode
public ReadWrite getMode()
Description copied from interface:TransactionInfoWhat mode is this transaction? This may change fromREADtoWRITEin a transactions lifetime.- Specified by:
getModein interfaceTransactionInfo
-
isReadTxn
public boolean isReadTxn()
Is this a READ transaction? Convenience operation equivalent to(getMode() == READ)- Specified by:
isReadTxnin interfaceTransactionInfo
-
isWriteTxn
public boolean isWriteTxn()
Is this a WRITE transaction? Convenience operation equivalent to(getMode() == WRITE)- Specified by:
isWriteTxnin interfaceTransactionInfo
-
isActiveTxn
public boolean isActiveTxn()
Description copied from interface:TransactionInfoIs this a view of a transaction that is active? Equivalent togetState() != INACTIVE- Specified by:
isActiveTxnin interfaceTransactionInfo
-
-