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 Details

    • type

      public final int type
    • long_value

      public volatile long long_value
    • ref_value

      public volatile Object ref_value
  • Constructor Details

    • BaseGammaTxnRef

      protected BaseGammaTxnRef(GammaStm stm, int type)
  • Method Details

    • flattenCommute

      public final boolean flattenCommute(GammaTxn tx, Tranlocal tranlocal, int lockMode)
    • evaluate

      private void evaluate(Tranlocal tranlocal, GammaTxn tx, Function function)
    • commit

      public final Listeners commit(Tranlocal tranlocal, GammaObjectPool pool)
    • leanCommit

      public final Listeners leanCommit(Tranlocal tranlocal)
    • prepare

      public final boolean prepare(GammaTxn tx, Tranlocal tranlocal)
    • 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)
    • openForConstruction

      public final Tranlocal openForConstruction(GammaTxn tx)
    • 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(GammaTxn tx, int lockMode)
    • 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(GammaTxn tx, int lockMode)
    • 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)
    • openForCommute

      public final void openForCommute(GammaTxn tx, Function function)
    • 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)
    • getLong

      protected final long getLong(GammaTxn tx, LockMode lockMode)
    • getObject

      protected final Object getObject(GammaTxn tx, LockMode lockMode)
    • setLong

      protected final long setLong(GammaTxn tx, LockMode lockMode, long newValue, boolean returnOld)
    • setObject

      protected final Object setObject(GammaTxn tx, LockMode lockMode, Object newValue, boolean returnOld)
    • atomicGetLong

      public final long atomicGetLong()
    • atomicObjectGet

      public final Object atomicObjectGet()
    • atomicSetLong

      public final long atomicSetLong(long newValue, boolean returnOld)
    • atomicSetObject

      public final Object atomicSetObject(Object newValue, boolean returnOld)
    • atomicCompareAndSetLong

      public final boolean atomicCompareAndSetLong(long expectedValue, long newValue)
    • acquire

      public final void acquire(LockMode desiredLockMode)
      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 a ReadWriteConflict. It could also be that the Lock is acquired, but the Txn sees that it isn't consistent anymore. In that case also a ReadWriteConflict 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

      public final void acquire(Txn tx, LockMode desiredLockMode)
      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 a ReadWriteConflict. It could also be that the Lock is acquired, but the Txn sees that it isn't consistent anymore. In that case also a ReadWriteConflict 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

      public final void acquire(GammaTxn tx, LockMode 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 tranlocal
      spinCount - the maximum number of times to spin
      desiredLockMode -
      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()