java.lang.Object
org.apache.jena.dboe.transaction.txn.Transaction
All Implemented Interfaces:
TransactionInfo

public final class Transaction extends 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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 Summary

    Modifier and Type
    Method
    Description
    void
     
    void
     
    void
     
    void
    end()
     
    void
    Require a WRITE transaction - includes trying to promote.
    long
    Each transaction is allocated a serialization point by the transaction coordinator.
    org.apache.jena.query.ReadWrite
    What mode is this transaction?
    The transaction lifecycle state
    Get the transaction id for this transaction.
    org.apache.jena.query.TxnType
    What type is this transaction?
    boolean
    Has the transaction gone through all lifecycle states?
    boolean
    Has the transaction finished (has commit/abort/end been called)?
    boolean
    Has the transaction started?
    boolean
    Is this a view of a transaction that is active?
    boolean
    Is this a READ transaction?
    boolean
    Is this a WRITE transaction?
    void
     
    void
     
    boolean
     
    boolean
    promote(boolean readCommitted)
     
    void
    Require a WRITE transaction - do not try to promote.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public TxnState getState()
      Description copied from interface: TransactionInfo
      The transaction lifecycle state
      Specified by:
      getState in interface TransactionInfo
    • 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:
      getDataVersion in interface TransactionInfo
    • 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: TransactionInfo
      Has the transaction started?
      Specified by:
      hasStarted in interface TransactionInfo
    • hasFinished

      public boolean hasFinished()
      Description copied from interface: TransactionInfo
      Has the transaction finished (has commit/abort/end been called)?
      Specified by:
      hasFinished in interface TransactionInfo
    • hasFinalised

      public boolean hasFinalised()
      Description copied from interface: TransactionInfo
      Has the transaction gone through all lifecycle states?
      Specified by:
      hasFinalised in interface TransactionInfo
    • getTxnId

      public TxnId getTxnId()
      Description copied from interface: TransactionInfo
      Get the transaction id for this transaction. Unique within this OS process (JVM) at least .
      Specified by:
      getTxnId in interface TransactionInfo
    • getTxnType

      public org.apache.jena.query.TxnType getTxnType()
      Description copied from interface: TransactionInfo
      What type is this transaction? This is the initial TxnType and does not change during a transaction's lifetime.
      Specified by:
      getTxnType in interface TransactionInfo
    • getMode

      public org.apache.jena.query.ReadWrite getMode()
      Description copied from interface: TransactionInfo
      What mode is this transaction? This may change from READ to WRITE in a transactions lifetime.
      Specified by:
      getMode in interface TransactionInfo
    • isReadTxn

      public boolean isReadTxn()
      Is this a READ transaction? Convenience operation equivalent to (getMode() == READ)
      Specified by:
      isReadTxn in interface TransactionInfo
    • isWriteTxn

      public boolean isWriteTxn()
      Is this a WRITE transaction? Convenience operation equivalent to (getMode() == WRITE)
      Specified by:
      isWriteTxn in interface TransactionInfo
    • isActiveTxn

      public boolean isActiveTxn()
      Description copied from interface: TransactionInfo
      Is this a view of a transaction that is active? Equivalent to getState() != INACTIVE
      Specified by:
      isActiveTxn in interface TransactionInfo