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
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Acquires a Lock with the provided LockMode.final void
Acquires a Lock with the provided LockMode using the provided transaction.final void
protected final int
final boolean
atomicCompareAndSetLong
(long expectedValue, long newValue) final long
final Object
final long
atomicSetLong
(long newValue, boolean returnOld) final Object
atomicSetObject
(Object newValue, boolean returnOld) final Listeners
commit
(Tranlocal tranlocal, GammaObjectPool pool) final void
ensure()
final void
final void
private void
final boolean
flattenCommute
(GammaTxn tx, Tranlocal tranlocal, int lockMode) protected final long
protected final Object
final boolean
hasReadConflict
(Tranlocal tranlocal) private void
initTranlocalForCommute
(GammaTxnConfig config, Tranlocal tranlocal) private void
initTranlocalForConstruction
(Tranlocal tranlocal) private static void
initTranlocalForRead
(GammaTxnConfig config, Tranlocal tranlocal) final Listeners
leanCommit
(Tranlocal tranlocal) final boolean
final void
openForCommute
(FatFixedLengthGammaTxn tx, Function function) final void
openForCommute
(FatMonoGammaTxn tx, Function function) final void
openForCommute
(FatVariableLengthGammaTxn tx, Function function) final void
openForCommute
(GammaTxn tx, Function function) final Tranlocal
final Tranlocal
final Tranlocal
final Tranlocal
final Tranlocal
openForRead
(FatFixedLengthGammaTxn tx, int desiredLockMode) final Tranlocal
openForRead
(FatMonoGammaTxn tx, int lockMode) final Tranlocal
openForRead
(FatVariableLengthGammaTxn tx, int desiredLockMode) final Tranlocal
openForRead
(GammaTxn tx, int lockMode) final Tranlocal
openForRead
(LeanFixedLengthGammaTxn tx, int lockMode) final Tranlocal
openForRead
(LeanMonoGammaTxn tx, int lockMode) final Tranlocal
openForWrite
(FatFixedLengthGammaTxn tx, int lockMode) final Tranlocal
openForWrite
(FatMonoGammaTxn tx, int desiredLockMode) final Tranlocal
openForWrite
(FatVariableLengthGammaTxn tx, int lockMode) final Tranlocal
openForWrite
(GammaTxn tx, int lockMode) final Tranlocal
openForWrite
(LeanFixedLengthGammaTxn tx, int lockMode) final Tranlocal
openForWrite
(LeanMonoGammaTxn tx, int lockMode) final boolean
final int
registerChangeListener
(RetryLatch latch, Tranlocal tranlocal, GammaObjectPool pool, long listenerEra) final void
releaseAfterFailure
(Tranlocal tranlocal, GammaObjectPool pool) final void
releaseAfterReading
(Tranlocal tranlocal, GammaObjectPool pool) final void
releaseAfterUpdate
(Tranlocal tranlocal, GammaObjectPool pool) protected final long
protected final Object
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.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
-
Field Details
-
type
public final int type -
long_value
public volatile long long_value -
ref_value
-
-
Constructor Details
-
BaseGammaTxnRef
-
-
Method Details
-
flattenCommute
-
evaluate
-
commit
-
leanCommit
-
prepare
-
releaseAfterFailure
-
releaseAfterUpdate
-
releaseAfterReading
-
load
-
openForConstruction
-
initTranlocalForConstruction
-
openForConstruction
-
openForConstruction
-
openForConstruction
-
openForRead
-
openForRead
-
openForRead
-
initTranlocalForRead
-
openForRead
-
openForRead
-
openForRead
-
openForWrite
-
openForWrite
-
openForWrite
-
openForWrite
-
openForWrite
-
openForWrite
-
openForCommute
-
initTranlocalForCommute
-
openForCommute
-
openForCommute
-
openForCommute
-
ensure
public final void ensure() -
ensure
-
ensure
-
getLong
-
getObject
-
setLong
-
setObject
-
atomicGetLong
public final long atomicGetLong() -
atomicObjectGet
-
atomicSetLong
public final long atomicSetLong(long newValue, boolean returnOld) -
atomicSetObject
-
atomicCompareAndSetLong
public final boolean atomicCompareAndSetLong(long expectedValue, long newValue) -
acquire
Description copied from interface:Lock
Acquires 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 aReadWriteConflict
is 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
Description copied from interface:Lock
Acquires 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 aReadWriteConflict
is 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.
-
acquire
-
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
-
arriveAndExclusiveLockOrBackoff
protected final int arriveAndExclusiveLockOrBackoff()
-