Class BaseGammaTxnRef
- java.lang.Object
-
- org.multiverse.stms.gamma.transactionalobjects.AbstractGammaObject
-
- org.multiverse.stms.gamma.transactionalobjects.BaseGammaTxnRef
-
- All Implemented Interfaces:
Lock,MultiverseConstants,GammaConstants,GammaObject
- Direct Known Subclasses:
GammaTxnBoolean,GammaTxnDouble,GammaTxnInteger,GammaTxnLong,GammaTxnRef
public abstract class BaseGammaTxnRef extends AbstractGammaObject
-
-
Field Summary
Fields Modifier and Type Field Description longlong_valuejava.lang.Objectref_valueinttype-
Fields inherited from class org.multiverse.stms.gamma.transactionalobjects.AbstractGammaObject
___unsafe, identityHashCode, listeners, listenersOffset, MASK_OREC_EXCLUSIVELOCK, MASK_OREC_READBIASED, MASK_OREC_READLOCKS, MASK_OREC_READONLY_COUNT, MASK_OREC_SURPLUS, MASK_OREC_UPDATELOCK, orec, stm, valueOffset, version
-
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 Modifier Constructor Description protectedBaseGammaTxnRef(GammaStm stm, int type)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquire(LockMode desiredLockMode)Acquires a Lock with the provided LockMode.voidacquire(Txn tx, LockMode desiredLockMode)Acquires a Lock with the provided LockMode using the provided transaction.voidacquire(GammaTxn tx, LockMode lockMode)protected intarriveAndExclusiveLockOrBackoff()booleanatomicCompareAndSetLong(long expectedValue, long newValue)longatomicGetLong()java.lang.ObjectatomicObjectGet()longatomicSetLong(long newValue, boolean returnOld)java.lang.ObjectatomicSetObject(java.lang.Object newValue, boolean returnOld)Listenerscommit(Tranlocal tranlocal, GammaObjectPool pool)voidensure()voidensure(Txn self)voidensure(GammaTxn tx)private voidevaluate(Tranlocal tranlocal, GammaTxn tx, Function function)booleanflattenCommute(GammaTxn tx, Tranlocal tranlocal, int lockMode)protected longgetLong(GammaTxn tx, LockMode lockMode)protected java.lang.ObjectgetObject(GammaTxn tx, LockMode lockMode)booleanhasReadConflict(Tranlocal tranlocal)private voidinitTranlocalForCommute(GammaTxnConfig config, Tranlocal tranlocal)private voidinitTranlocalForConstruction(Tranlocal tranlocal)private static voidinitTranlocalForRead(GammaTxnConfig config, Tranlocal tranlocal)ListenersleanCommit(Tranlocal tranlocal)booleanload(GammaTxn tx, Tranlocal tranlocal, int lockMode, int spinCount, boolean arriveNeeded)voidopenForCommute(FatFixedLengthGammaTxn tx, Function function)voidopenForCommute(FatMonoGammaTxn tx, Function function)voidopenForCommute(FatVariableLengthGammaTxn tx, Function function)voidopenForCommute(GammaTxn tx, Function function)TranlocalopenForConstruction(FatFixedLengthGammaTxn tx)TranlocalopenForConstruction(FatMonoGammaTxn tx)TranlocalopenForConstruction(FatVariableLengthGammaTxn tx)TranlocalopenForConstruction(GammaTxn tx)TranlocalopenForRead(FatFixedLengthGammaTxn tx, int desiredLockMode)TranlocalopenForRead(FatMonoGammaTxn tx, int lockMode)TranlocalopenForRead(FatVariableLengthGammaTxn tx, int desiredLockMode)TranlocalopenForRead(GammaTxn tx, int lockMode)TranlocalopenForRead(LeanFixedLengthGammaTxn tx, int lockMode)TranlocalopenForRead(LeanMonoGammaTxn tx, int lockMode)TranlocalopenForWrite(FatFixedLengthGammaTxn tx, int lockMode)TranlocalopenForWrite(FatMonoGammaTxn tx, int desiredLockMode)TranlocalopenForWrite(FatVariableLengthGammaTxn tx, int lockMode)TranlocalopenForWrite(GammaTxn tx, int lockMode)TranlocalopenForWrite(LeanFixedLengthGammaTxn tx, int lockMode)TranlocalopenForWrite(LeanMonoGammaTxn tx, int lockMode)booleanprepare(GammaTxn tx, Tranlocal tranlocal)intregisterChangeListener(RetryLatch latch, Tranlocal tranlocal, GammaObjectPool pool, long listenerEra)voidreleaseAfterFailure(Tranlocal tranlocal, GammaObjectPool pool)voidreleaseAfterReading(Tranlocal tranlocal, GammaObjectPool pool)voidreleaseAfterUpdate(Tranlocal tranlocal, GammaObjectPool pool)protected longsetLong(GammaTxn tx, LockMode lockMode, long newValue, boolean returnOld)protected java.lang.ObjectsetObject(GammaTxn tx, LockMode lockMode, java.lang.Object newValue, boolean returnOld)booleantryLockAndCheckConflict(GammaTxn tx, Tranlocal tranlocal, int spinCount, int desiredLockMode)Tries to acquire a lock on a previous read/written tranlocal and checks for conflict.-
Methods inherited from class org.multiverse.stms.gamma.transactionalobjects.AbstractGammaObject
___removeListenersAfterWrite, ___toOrecString, arrive, arriveAndExclusiveLock, arriveAndLock, atomicGetLockMode, atomicGetLockModeAsInt, departAfterFailure, departAfterFailureAndUnlock, departAfterReading, departAfterReadingAndUnlock, departAfterUpdateAndUnlock, getLock, getLockMode, getLockMode, getLockMode, getReadBiasedThreshold, getReadLockCount, getReadLockCount, getReadonlyCount, getReadonlyCount, getStm, getSurplus, getSurplus, getVersion, hasAnyLock, hasExclusiveLock, hasExclusiveLock, hasWriteLock, hasWriteLock, hasWriteOrExclusiveLock, identityHashCode, isReadBiased, isReadBiased, lockAfterArrive, setExclusiveLock, setIsReadBiased, setReadLockCount, setReadonlyCount, setSurplus, setWriteLock, unlockByUnregistered, upgradeReadLock, upgradeWriteLock, waitForExclusiveLockToBecomeFree
-
-
-
-
Constructor Detail
-
BaseGammaTxnRef
protected BaseGammaTxnRef(GammaStm stm, int type)
-
-
Method Detail
-
commit
public final Listeners commit(Tranlocal tranlocal, GammaObjectPool pool)
-
releaseAfterFailure
public final void releaseAfterFailure(Tranlocal tranlocal, GammaObjectPool pool)
-
releaseAfterUpdate
public final void releaseAfterUpdate(Tranlocal tranlocal, GammaObjectPool pool)
-
releaseAfterReading
public final void releaseAfterReading(Tranlocal tranlocal, GammaObjectPool pool)
-
load
public final boolean load(GammaTxn tx, Tranlocal tranlocal, int lockMode, int spinCount, boolean arriveNeeded)
-
initTranlocalForConstruction
private void initTranlocalForConstruction(Tranlocal tranlocal)
-
openForConstruction
public final Tranlocal openForConstruction(FatMonoGammaTxn tx)
-
openForConstruction
public final Tranlocal openForConstruction(FatVariableLengthGammaTxn tx)
-
openForConstruction
public final Tranlocal openForConstruction(FatFixedLengthGammaTxn tx)
-
openForRead
public final Tranlocal openForRead(LeanMonoGammaTxn tx, int lockMode)
-
openForRead
public final Tranlocal openForRead(LeanFixedLengthGammaTxn tx, int lockMode)
-
initTranlocalForRead
private static void initTranlocalForRead(GammaTxnConfig config, Tranlocal tranlocal)
-
openForRead
public final Tranlocal openForRead(FatMonoGammaTxn tx, int lockMode)
-
openForRead
public final Tranlocal openForRead(FatFixedLengthGammaTxn tx, int desiredLockMode)
-
openForRead
public final Tranlocal openForRead(FatVariableLengthGammaTxn tx, int desiredLockMode)
-
openForWrite
public final Tranlocal openForWrite(LeanMonoGammaTxn tx, int lockMode)
-
openForWrite
public final Tranlocal openForWrite(LeanFixedLengthGammaTxn tx, int lockMode)
-
openForWrite
public final Tranlocal openForWrite(FatMonoGammaTxn tx, int desiredLockMode)
-
openForWrite
public final Tranlocal openForWrite(FatFixedLengthGammaTxn tx, int lockMode)
-
openForWrite
public final Tranlocal openForWrite(FatVariableLengthGammaTxn tx, int lockMode)
-
initTranlocalForCommute
private void initTranlocalForCommute(GammaTxnConfig config, Tranlocal tranlocal)
-
openForCommute
public final void openForCommute(FatMonoGammaTxn tx, Function function)
-
openForCommute
public final void openForCommute(FatFixedLengthGammaTxn tx, Function function)
-
openForCommute
public final void openForCommute(FatVariableLengthGammaTxn tx, Function function)
-
ensure
public final void ensure()
-
ensure
public final void ensure(Txn self)
-
ensure
public final void ensure(GammaTxn tx)
-
setLong
protected final long setLong(GammaTxn tx, LockMode lockMode, long newValue, boolean returnOld)
-
setObject
protected final java.lang.Object setObject(GammaTxn tx, LockMode lockMode, java.lang.Object newValue, boolean returnOld)
-
atomicGetLong
public final long atomicGetLong()
-
atomicObjectGet
public final java.lang.Object atomicObjectGet()
-
atomicSetLong
public final long atomicSetLong(long newValue, boolean returnOld)
-
atomicSetObject
public final java.lang.Object atomicSetObject(java.lang.Object newValue, boolean returnOld)
-
atomicCompareAndSetLong
public final boolean atomicCompareAndSetLong(long expectedValue, long newValue)
-
acquire
public final void acquire(LockMode desiredLockMode)
Description copied from interface:LockAcquires a Lock with the provided LockMode. This call doesn't block if the Lock can't be upgraded, but throws aReadWriteConflict. It could also be that the Lock is acquired, but the Txn sees that it isn't consistent anymore. In that case also aReadWriteConflictis thrown.This call makes use of the Txn stored in the
TxnThreadLocal.If the lockMode is lower than the LockMode the transaction already has on this Lock, the call is ignored.
- Parameters:
desiredLockMode- the desired lockMode.
-
acquire
public final void acquire(Txn tx, LockMode desiredLockMode)
Description copied from interface:LockAcquires a Lock with the provided LockMode using the provided transaction. This call doesn't block if the Lock can't be upgraded but throws aReadWriteConflict. It could also be that the Lock is acquired, but the Txn sees that it isn't consistent anymore. In that case also aReadWriteConflictis thrown.If the lockMode is lower than the LockMode the transaction already has on this Lock, the call is ignored.
- Parameters:
tx- the Txn used for this operation.desiredLockMode- the desired lockMode.
-
tryLockAndCheckConflict
public final boolean tryLockAndCheckConflict(GammaTxn tx, Tranlocal tranlocal, int spinCount, int desiredLockMode)
Tries to acquire a lock on a previous read/written tranlocal and checks for conflict. If the lockMode == LOCKMODE_NONE, this call is ignored. The call to this method can safely made if the current lock level is higher the the desired LockMode. If the can't be acquired, no changes are made on the tranlocal.- Parameters:
tx-tranlocal- the tranlocalspinCount- the maximum number of times to spindesiredLockMode-- Returns:
- true if the lock was acquired successfully and there was no conflict.
-
registerChangeListener
public final int registerChangeListener(RetryLatch latch, Tranlocal tranlocal, GammaObjectPool pool, long listenerEra)
-
hasReadConflict
public final boolean hasReadConflict(Tranlocal tranlocal)
-
arriveAndExclusiveLockOrBackoff
protected final int arriveAndExclusiveLockOrBackoff()
-
-