Class FatFixedLengthGammaTxn

java.lang.Object
org.multiverse.stms.gamma.transactions.GammaTxn
org.multiverse.stms.gamma.transactions.fat.FatFixedLengthGammaTxn
All Implemented Interfaces:
Txn, MultiverseConstants, GammaConstants

public final class FatFixedLengthGammaTxn extends GammaTxn
A Fat GammaTxn (supporting all features) but has a fixed capacity.
  • Field Details

    • size

      public int size
    • hasReads

      public boolean hasReads
    • localConflictCount

      public long localConflictCount
    • listenersArray

      public final Listeners[] listenersArray
  • Constructor Details

    • FatFixedLengthGammaTxn

      public FatFixedLengthGammaTxn(GammaStm stm)
    • FatFixedLengthGammaTxn

      public FatFixedLengthGammaTxn(GammaTxnConfig config)
  • Method Details

    • commit

      public final void commit()
      Description copied from interface: Txn
      Commits this Txn. If the Txn is:
      1. active: it is prepared for commit and then committed
      2. prepared: it is committed. Once it is prepared, the commit is guaranteed to succeed.
      3. aborted: a DeadTxnException is thrown
      4. committed: the call is ignored

      Txn will always be aborted if the commit does not succeed.

      Commit will not throw a ReadWriteConflict after the transaction is prepared. So if prepared successfully, a commit will always succeed.

      If there are TxnListeners (either normal ones or permanent ones) and they thrown a RuntimeException or Error, this will be re-thrown. If a listener fails after the prepare/commit the transaction still is committed.

      Specified by:
      commit in interface Txn
      Specified by:
      commit in class GammaTxn
    • commitChain

      private Listeners[] commitChain()
    • prepare

      public final void prepare()
      Description copied from interface: Txn
      Prepares this transaction to be committed. It can lock resources to make sure that no conflicting changes are made after the transaction has been prepared. If the transaction already is prepared, the call is ignored. If the prepare fails, the transaction automatically is aborted. Once a transaction is prepared, the commit will always succeed.

      It is very important that the transaction eventually commits or aborts, if it doesn't no other transaction reading/writing the committed resources, can't commit.

    • prepareChainForCommit

      private BaseGammaTxnRef prepareChainForCommit()
    • abort

      public final void abort()
      Description copied from interface: Txn
      Aborts this Txn. This means that the changes made in this transaction are not committed. It depends on the implementation if this operation is simple (ditching objects for example), or if changes need to be rolled back. If an exception is thrown while executing the abort, the transaction is still aborted. And example of such a situation is a pre-abort task that fails. So the transaction always is aborted (unless it is committed).

      If the Txn already is aborted, the call is ignored.

      Specified by:
      abort in interface Txn
      Specified by:
      abort in class GammaTxn
    • releaseChain

      private void releaseChain(boolean success)
    • getRefTranlocal

      public final Tranlocal getRefTranlocal(BaseGammaTxnRef ref)
      Description copied from class: GammaTxn
      Gets the Tranlocal for a specific AbstractGammaTxnRef. This method doesn't care about the state of a transaction.
      Specified by:
      getRefTranlocal in class GammaTxn
      Parameters:
      ref - the AbstractGammaTxnRef
      Returns:
      the found Tranlocal or null if not found.
    • retry

      public final void retry()
      Description copied from interface: Txn
      Retries the transaction. This call doesn't block, but if all goes well a RetryError is thrown which is caught by the TxnExecutor.
    • locate

      public final Tranlocal locate(BaseGammaTxnRef o)
      Specified by:
      locate in class GammaTxn
    • hardReset

      public final void hardReset()
      Description copied from class: GammaTxn
      Does a hard reset of an aborted/committed transaction. This means that it is made ready to be used by another transaction configuration.
      Specified by:
      hardReset in class GammaTxn
    • softReset

      public final boolean softReset()
      Description copied from class: GammaTxn
      Does a soft reset of an aborted/committed transaction. This method is called when the execution of a transaction fails, but needs to be retried again.
      Specified by:
      softReset in class GammaTxn
      Returns:
      if another attempt can be made, false otherwise.
    • shiftInFront

      public final void shiftInFront(Tranlocal newHead)
    • isReadConsistent

      public final boolean isReadConsistent(Tranlocal justAdded)
      Specified by:
      isReadConsistent in class GammaTxn
    • initLocalConflictCounter

      public void initLocalConflictCounter()
      Description copied from class: GammaTxn
      Initializes the local conflict counter if the transaction has a need for it. It should only be initialized if there are no reads.
      Specified by:
      initLocalConflictCounter in class GammaTxn