Class FatFixedLengthGammaTxn
java.lang.Object
org.multiverse.stms.gamma.transactions.GammaTxn
org.multiverse.stms.gamma.transactions.fat.FatFixedLengthGammaTxn
- All Implemented Interfaces:
Txn,MultiverseConstants,GammaConstants
A Fat
GammaTxn (supporting all features) but has a fixed capacity.-
Field Summary
FieldsFields inherited from class org.multiverse.stms.gamma.transactions.GammaTxn
abortOnly, attempt, commitConflict, config, evaluatingCommute, hasWrites, listeners, pool, remainingTimeoutNs, retryListener, richmansMansConflictScan, status, transactionTypeFields inherited from interface org.multiverse.stms.gamma.GammaConstants
FAILURE, MASK_CONFLICT, MASK_SUCCESS, MASK_UNREGISTERED, REGISTRATION_DONE, REGISTRATION_NONE, REGISTRATION_NOT_NEEDED, TRANLOCAL_COMMUTING, TRANLOCAL_CONSTRUCTING, TRANLOCAL_READ, TRANLOCAL_WRITE, TRANSACTIONTYPE_FAT_FIXED_LENGTH, TRANSACTIONTYPE_FAT_MONO, TRANSACTIONTYPE_FAT_VARIABLE_LENGTH, TRANSACTIONTYPE_LEAN_FIXED_LENGTH, TRANSACTIONTYPE_LEAN_MONO, TX_ABORTED, TX_ACTIVE, TX_COMMITTED, TX_PREPARED, TYPE_BOOLEAN, TYPE_DOUBLE, TYPE_INT, TYPE_LONG, TYPE_REF, VERSION_UNCOMMITTEDFields inherited from interface org.multiverse.MultiverseConstants
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidabort()Aborts this Txn.final voidcommit()Commits this Txn.private Listeners[]final TranlocalGets the Tranlocal for a specific AbstractGammaTxnRef.final voidDoes a hard reset of an aborted/committed transaction.voidInitializes the local conflict counter if the transaction has a need for it.final booleanisReadConsistent(Tranlocal justAdded) final Tranlocalfinal voidprepare()Prepares this transaction to be committed.private BaseGammaTxnRefprivate voidreleaseChain(boolean success) final voidretry()Retries the transaction.final voidshiftInFront(Tranlocal newHead) final booleanDoes a soft reset of an aborted/committed transaction.Methods inherited from class org.multiverse.stms.gamma.transactions.GammaTxn
abortAcquireOnNullLockMode, abortCommitOnAbortOnly, abortCommitOnBadStatus, abortCommuteOnBadStatus, abortCommuteOnBadStm, abortCommuteOnCommuteDetected, abortCommuteOnNullFunction, abortCommuteOnReadonly, abortEnsureOnBadStatus, abortEnsureOnEnsureDetected, abortIfAlive, abortLocateOnBadStatus, abortLocateOnNullArgument, abortOnOpenForCommuteWhileEvaluatingCommute, abortOnOpenForConstructionWhileEvaluatingCommute, abortOnOpenForReadWhileEvaluatingCommute, abortOnReadWriteConflict, abortOnRichmanConflictScanDetected, abortOnTransactionTooSmall, abortOpenForConstructionOnBadReference, abortOpenForConstructionOnBadStatus, abortOpenForConstructionOnBadStm, abortOpenForConstructionOnReadonly, abortOpenForConstructionRequired, abortOpenForReadOnBadStatus, abortOpenForReadOnBadStm, abortOpenForReadOnNonRefTypeDetected, abortOpenForReadOnNullLockMode, abortOpenForReadOrWriteOnExplicitLockingDetected, abortOpenForWriteOnReadonly, abortPrepareOnAbortOnly, abortPrepareOnBadStatus, abortRegisterOnListenerRequired, abortRetryOnBadStatus, abortRetryOnNoBlockingAllowed, abortRetryOnNoRetryPossible, awaitUpdate, copyForSpeculativeFailure, failAbortOnAlreadyCommitted, getAttempt, getConfig, getRemainingTimeoutNs, getStatus, hasWrites, init, isAbortOnly, isAlive, isLean, newRetryError, notifyListeners, register, setAbortOnly, skipPrepare
-
Field Details
-
head
-
size
public int size -
hasReads
public boolean hasReads -
localConflictCount
public long localConflictCount -
listenersArray
-
-
Constructor Details
-
FatFixedLengthGammaTxn
-
FatFixedLengthGammaTxn
-
-
Method Details
-
commit
public final void commit()Description copied from interface:TxnCommits this Txn. If the Txn is:- active: it is prepared for commit and then committed
- prepared: it is committed. Once it is prepared, the commit is guaranteed to succeed.
- aborted: a DeadTxnException is thrown
- committed: the call is ignored
Txn will always be aborted if the commit does not succeed.
Commit will not throw a
ReadWriteConflictafter 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
RuntimeExceptionorError, this will be re-thrown. If a listener fails after the prepare/commit the transaction still is committed. -
commitChain
-
prepare
public final void prepare()Description copied from interface:TxnPrepares 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
-
abort
public final void abort()Description copied from interface:TxnAborts 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.
-
releaseChain
private void releaseChain(boolean success) -
getRefTranlocal
Description copied from class:GammaTxnGets the Tranlocal for a specific AbstractGammaTxnRef. This method doesn't care about the state of a transaction.- Specified by:
getRefTranlocalin classGammaTxn- Parameters:
ref- the AbstractGammaTxnRef- Returns:
- the found Tranlocal or null if not found.
-
retry
public final void retry()Description copied from interface:TxnRetries the transaction. This call doesn't block, but if all goes well aRetryErroris thrown which is caught by theTxnExecutor. -
locate
-
hardReset
public final void hardReset()Description copied from class:GammaTxnDoes a hard reset of an aborted/committed transaction. This means that it is made ready to be used by another transaction configuration. -
softReset
public final boolean softReset()Description copied from class:GammaTxnDoes 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. -
shiftInFront
-
isReadConsistent
- Specified by:
isReadConsistentin classGammaTxn
-
initLocalConflictCounter
public void initLocalConflictCounter()Description copied from class:GammaTxnInitializes the local conflict counter if the transaction has a need for it. It should only be initialized if there are no reads.- Specified by:
initLocalConflictCounterin classGammaTxn
-