public abstract class GammaTxn extends Object implements GammaConstants, Txn
Modifier and Type | Field and Description |
---|---|
boolean |
abortOnly |
int |
attempt |
boolean |
commitConflict |
GammaTxnConfig |
config |
boolean |
evaluatingCommute |
boolean |
hasWrites |
ArrayList<TxnListener> |
listeners |
GammaObjectPool |
pool |
long |
remainingTimeoutNs |
RetryLatch |
retryListener |
boolean |
richmansMansConflictScan |
int |
status |
int |
transactionType |
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
LOCKMODE_EXCLUSIVE, LOCKMODE_NONE, LOCKMODE_READ, LOCKMODE_WRITE, SHAKE_BUGS, SPIN_YIELD, TRACING_ENABLED
Constructor and Description |
---|
GammaTxn(GammaTxnConfig config,
int transactionType) |
public final GammaObjectPool pool
public int status
public GammaTxnConfig config
public int attempt
public long remainingTimeoutNs
public boolean hasWrites
public final int transactionType
public boolean richmansMansConflictScan
public boolean abortOnly
public final RetryLatch retryListener
public ArrayList<TxnListener> listeners
public boolean commitConflict
public boolean evaluatingCommute
public GammaTxn(GammaTxnConfig config, int transactionType)
protected void notifyListeners(TxnEvent event)
protected RetryError newRetryError()
public final boolean isLean()
public final void abortIfAlive()
public AbortOnlyException abortPrepareOnAbortOnly()
public AbortOnlyException abortCommitOnAbortOnly()
public final ReadWriteConflict abortOnReadWriteConflict(GammaObject object)
public DeadTxnException failAbortOnAlreadyCommitted()
public SpeculativeConfigurationError abortOpenForReadOrWriteOnExplicitLockingDetected(BaseGammaTxnRef ref)
public SpeculativeConfigurationError abortOpenForReadOnNonRefTypeDetected(BaseGammaTxnRef ref)
public final StmMismatchException abortOpenForReadOnBadStm(GammaObject o)
public IllegalTxnStateException abortOpenForReadOnNullLockMode(BaseGammaTxnRef object)
public final IllegalTxnStateException abortOpenForReadOnBadStatus(GammaObject object)
public final ReadonlyException abortOpenForWriteOnReadonly(GammaObject object)
public final IllegalTxnStateException abortRetryOnNoRetryPossible()
public final RetryNotAllowedException abortRetryOnNoBlockingAllowed()
public final IllegalTxnStateException abortRetryOnBadStatus()
public final IllegalArgumentException abortOpenForConstructionOnBadReference(GammaObject ref)
public final IllegalTxnStateException abortOpenForConstructionOnBadStatus(GammaObject o)
public final StmMismatchException abortOpenForConstructionOnBadStm(GammaObject o)
public ReadonlyException abortOpenForConstructionOnReadonly(GammaObject o)
public SpeculativeConfigurationError abortOpenForConstructionRequired(BaseGammaTxnRef ref)
public SpeculativeConfigurationError abortCommuteOnCommuteDetected(BaseGammaTxnRef ref)
public IllegalTxnStateException abortCommuteOnBadStatus(GammaObject object, Function function)
public StmMismatchException abortCommuteOnBadStm(GammaObject object)
public ReadonlyException abortCommuteOnReadonly(GammaObject object)
public NullPointerException abortCommuteOnNullFunction(GammaObject object)
public final IllegalTxnStateException abortLocateOnBadStatus(GammaObject object)
public final NullPointerException abortLocateOnNullArgument()
public SpeculativeConfigurationError abortRegisterOnListenerRequired()
public final IllegalTxnStateException abortPrepareOnBadStatus()
public final IllegalTxnStateException abortCommitOnBadStatus()
public TxnExecutionException abortOnOpenForConstructionWhileEvaluatingCommute(GammaObject o)
public TxnExecutionException abortOnOpenForReadWhileEvaluatingCommute(GammaObject o)
public TxnExecutionException abortOnOpenForCommuteWhileEvaluatingCommute(GammaObject o)
public IllegalTxnStateException abortEnsureOnBadStatus(BaseGammaTxnRef o)
public final SpeculativeConfigurationError abortOnTransactionTooSmall(int minimalSize)
public final SpeculativeConfigurationError abortOnRichmanConflictScanDetected()
public SpeculativeConfigurationError abortEnsureOnEnsureDetected(GammaObject o)
public final NullPointerException abortAcquireOnNullLockMode(GammaObject o)
public final boolean hasWrites()
public abstract void commit()
Txn
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.
public abstract void abort()
Txn
If the Txn already is aborted, the call is ignored.
public abstract Tranlocal locate(BaseGammaTxnRef o)
public final GammaTxnConfig getConfig()
Txn
Because the Txn can be reused, the TxnConfig used by this Txn doesn't need to be constant.
public final int getAttempt()
Txn
TxnConfig.getMaxRetries()
getAttempt
in interface Txn
public final long getRemainingTimeoutNs()
Txn
The remaining timeout only is decreased if a transaction blocks on a retry or when doing a backoff.
getRemainingTimeoutNs
in interface Txn
public boolean isAbortOnly()
Txn
This method is not threadsafe, so can only be called by the thread that used the transaction.
isAbortOnly
in interface Txn
public final void setAbortOnly()
Txn
AbortOnlyException
is thrown.
This method is not threadsafe, so can only be called by the thread that used the transaction.
setAbortOnly
in interface Txn
public void register(TxnListener listener)
Txn
TxnFactoryBuilder.addPermanentListener(org.multiverse.api.lifecycle.TxnListener)
.
If a TxnListener is added more than once, it is executed more than once. No checks are made. The permanent listeners are executed in the order they are added.
If a TxnListener throws an Error/RuntimeException and the transaction still is alive, it is aborted. For compensating and deferred actions this is not an issue, but for the PrePrepare state or the state it could since the transaction is aborted.
public abstract void hardReset()
public abstract boolean softReset()
public abstract Tranlocal getRefTranlocal(BaseGammaTxnRef ref)
ref
- the AbstractGammaTxnRefpublic final boolean isAlive()
public final void awaitUpdate()
public final void copyForSpeculativeFailure(GammaTxn failingTx)
public final void init(GammaTxnConfig config)
public abstract boolean isReadConsistent(Tranlocal justAdded)
public final TxnStatus getStatus()
Txn
public final boolean skipPrepare()
public abstract void initLocalConflictCounter()
Copyright © 2020. All rights reserved.