Class FatVariableLengthGammaTxn
- java.lang.Object
-
- org.multiverse.stms.gamma.transactions.GammaTxn
-
- org.multiverse.stms.gamma.transactions.fat.FatVariableLengthGammaTxn
-
- All Implemented Interfaces:
Txn
,MultiverseConstants
,GammaConstants
public final class FatVariableLengthGammaTxn extends GammaTxn
-
-
Field Summary
Fields Modifier and Type Field Description Tranlocal[]
array
boolean
hasReads
long
localConflictCount
int
size
-
Fields inherited from class org.multiverse.stms.gamma.transactions.GammaTxn
abortOnly, attempt, commitConflict, config, evaluatingCommute, hasWrites, listeners, pool, remainingTimeoutNs, retryListener, richmansMansConflictScan, status, transactionType
-
Fields 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_UNCOMMITTED
-
Fields inherited from interface org.multiverse.MultiverseConstants
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED
-
-
Constructor Summary
Constructors Constructor Description FatVariableLengthGammaTxn(GammaStm stm)
FatVariableLengthGammaTxn(GammaTxnConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
abort()
Aborts this Txn.void
attach(Tranlocal tranlocal, int hash)
void
commit()
Commits this Txn.private Listeners[]
commitArray()
private GammaObject
doPrepare()
private void
expand()
Tranlocal
getRefTranlocal(BaseGammaTxnRef ref)
Gets the Tranlocal for a specific AbstractGammaTxnRef.float
getUsage()
void
hardReset()
Does a hard reset of an aborted/committed transaction.int
indexOf(BaseGammaTxnRef ref, int hash)
void
initLocalConflictCounter()
Initializes the local conflict counter if the transaction has a need for it.boolean
isReadConsistent(Tranlocal justAdded)
Tranlocal
locate(BaseGammaTxnRef o)
void
prepare()
Prepares this transaction to be committed.private void
releaseArray(boolean success)
void
retry()
Retries the transaction.int
size()
boolean
softReset()
Does 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 Detail
-
array
public Tranlocal[] array
-
size
public int size
-
hasReads
public boolean hasReads
-
localConflictCount
public long localConflictCount
-
-
Constructor Detail
-
FatVariableLengthGammaTxn
public FatVariableLengthGammaTxn(GammaStm stm)
-
FatVariableLengthGammaTxn
public FatVariableLengthGammaTxn(GammaTxnConfig config)
-
-
Method Detail
-
commit
public final void commit()
Description copied from interface:Txn
Commits 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
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
orError
, this will be re-thrown. If a listener fails after the prepare/commit the transaction still is committed.
-
commitArray
private Listeners[] commitArray()
-
releaseArray
private void releaseArray(boolean success)
-
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.
-
doPrepare
private GammaObject doPrepare()
-
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.
-
locate
public final Tranlocal locate(BaseGammaTxnRef o)
-
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 classGammaTxn
- 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 aRetryError
is thrown which is caught by theTxnExecutor
.
-
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.
-
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.
-
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 classGammaTxn
-
isReadConsistent
public final boolean isReadConsistent(Tranlocal justAdded)
- Specified by:
isReadConsistent
in classGammaTxn
-
getUsage
public final float getUsage()
-
size
public final int size()
-
indexOf
public final int indexOf(BaseGammaTxnRef ref, int hash)
-
attach
public final void attach(Tranlocal tranlocal, int hash)
-
expand
private void expand()
-
-