Class Transaction
java.lang.Object
org.apache.jena.dboe.transaction.txn.Transaction
- All Implemented Interfaces:
TransactionInfo
A transaction as the composition of actions on components.
Works in conjunction with the TransactionCoordinator
to provide the transaction lifecycle.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTransaction(TransactionCoordinator txnMgr, org.apache.jena.query.TxnType txnType, org.apache.jena.query.ReadWrite readWrite, TxnId txnId, long dataVersion, List<org.apache.jena.dboe.transaction.txn.SysTrans> components) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidbegin()voidcommit()voidend()voidRequire a WRITE transaction - includes trying to promote.longEach transaction is allocated a serialization point by the transaction coordinator.org.apache.jena.query.ReadWritegetMode()What mode is this transaction?getState()The transaction lifecycle stategetTxnId()Get the transaction id for this transaction.org.apache.jena.query.TxnTypeWhat type is this transaction?booleanHas the transaction gone through all lifecycle states?booleanHas the transaction finished (has commit/abort/end been called)?booleanHas the transaction started?booleanIs this a view of a transaction that is active?booleanIs this a READ transaction?booleanIs this a WRITE transaction?voidvoidprepare()booleanpromote()booleanpromote(boolean readCommitted) voidRequire a WRITE transaction - do not try to promote.
-
Constructor Details
-
Transaction
public Transaction(TransactionCoordinator txnMgr, org.apache.jena.query.TxnType txnType, org.apache.jena.query.ReadWrite readWrite, TxnId txnId, long dataVersion, List<org.apache.jena.dboe.transaction.txn.SysTrans> components)
-
-
Method Details
-
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
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 org.apache.jena.query.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 org.apache.jena.query.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
-