Class GammaTxnConfig

  • All Implemented Interfaces:
    TxnConfig, MultiverseConstants, GammaConstants

    public final class GammaTxnConfig
    extends Object
    implements TxnConfig, GammaConstants
    A configuration object that contains the configuration for a GammaTxn.

    GammaTxnConfig object is considered to be immutable. The only mutable part if the speculative configuration that can get upgraded if enabled and speculations failed.

    • Field Detail

      • idGenerator

        public static final AtomicLong idGenerator
      • writeSkewAllowed

        public boolean writeSkewAllowed
      • inconsistentReadAllowed

        public boolean inconsistentReadAllowed
      • readLockMode

        public LockMode readLockMode
      • writeLockMode

        public LockMode writeLockMode
      • readLockModeAsInt

        public int readLockModeAsInt
      • writeLockModeAsInt

        public int writeLockModeAsInt
      • familyName

        public String familyName
      • isAnonymous

        public boolean isAnonymous
      • interruptible

        public boolean interruptible
      • readonly

        public boolean readonly
      • spinCount

        public int spinCount
      • dirtyCheck

        public boolean dirtyCheck
      • minimalArrayTreeSize

        public int minimalArrayTreeSize
      • trackReads

        public boolean trackReads
      • blockingAllowed

        public boolean blockingAllowed
      • maxRetries

        public int maxRetries
      • speculative

        public boolean speculative
      • maxFixedLengthTransactionSize

        public int maxFixedLengthTransactionSize
      • timeoutNs

        public long timeoutNs
      • controlFlowErrorsReused

        public boolean controlFlowErrorsReused
      • isFat

        public boolean isFat
      • maximumPoorMansConflictScanLength

        public int maximumPoorMansConflictScanLength
      • unrepeatableReadAllowed

        public boolean unrepeatableReadAllowed
    • Constructor Detail

      • GammaTxnConfig

        public GammaTxnConfig​(GammaStm stm)
      • GammaTxnConfig

        public GammaTxnConfig​(GammaStm stm,
                              int maxFixedLengthTransactionSize)
    • Method Detail

      • isSpeculative

        public boolean isSpeculative()
        Description copied from interface: TxnConfig
        Checks if speculative configuration is enabled. When enabled the STM is able to select better performing/scalable implementations at the cost of some SpeculativeConfigurationError. This will be caught by the TxnExecutor and the transaction will be retried, so in most cases this is not something to worry about, but it can be confusing in the beginning because of unexpected failures in the execution of transactions.
        Specified by:
        isSpeculative in interface TxnConfig
        Returns:
        true if speculative configuration is enabled.
        See Also:
        TxnFactoryBuilder.setSpeculative(boolean)
      • getFamilyName

        public String getFamilyName()
        Description copied from interface: TxnConfig
        Returns the family name of this Txn. Every transaction in principle should have a family name. This information can be used for debugging/logging purposes but also other techniques that rely to know something about similar types of transactions like profiling.
        Specified by:
        getFamilyName in interface TxnConfig
        Returns:
        the familyName. The returned value can be null.
        See Also:
        TxnFactoryBuilder.setFamilyName(String)
      • isReadonly

        public boolean isReadonly()
        Description copied from interface: TxnConfig
        Checks if this Txn is readonly. With a readonly transaction you can prevent any updates or new objects being created.
        Specified by:
        isReadonly in interface TxnConfig
        Returns:
        true if readonly, false otherwise.
        See Also:
        TxnFactoryBuilder.setReadonly(boolean)
      • getSpinCount

        public int getSpinCount()
        Description copied from interface: TxnConfig
        Returns the maximum number of times the transaction is allowed to spin on a read to become readable (perhaps it is locked).
        Specified by:
        getSpinCount in interface TxnConfig
        Returns:
        the maximum number of spins
        See Also:
        TxnFactoryBuilder.setSpinCount(int)
      • getStm

        public GammaStm getStm()
        Description copied from interface: TxnConfig
        Returns the Stm that creates transactions based on this configuration.
        Specified by:
        getStm in interface TxnConfig
        Returns:
        the stm.
      • isReadTrackingEnabled

        public boolean isReadTrackingEnabled()
        Description copied from interface: TxnConfig
        Checks if this transaction does automatic read tracking. Read tracking is needed for blocking transactions, but also for writeskew detection. Disadvantage of read tracking is that it is more expensive because the reads not to be registered on some datastructure so that they are tracked.
        Specified by:
        isReadTrackingEnabled in interface TxnConfig
        Returns:
        true if the transaction does automatic read tracking, false otherwise.
        See Also:
        TxnFactoryBuilder.setReadTrackingEnabled(boolean)
      • isBlockingAllowed

        public boolean isBlockingAllowed()
        Description copied from interface: TxnConfig
        If an explicit retry (so a blocking transaction) is allowed. With this property one can prevent that a Txn is able to block waiting for some change.
        Specified by:
        isBlockingAllowed in interface TxnConfig
        Returns:
        true if explicit retry is allowed, false otherwise.
        See Also:
        TxnFactoryBuilder.setBlockingAllowed(boolean)
      • getMaxRetries

        public int getMaxRetries()
        Description copied from interface: TxnConfig
        Returns the maximum number of times this Txn be retried before failing. The returned value will always be equal or larger than 0. If the value is getAndSet high and you are encountering a lot of TooManyRetryExceptions it could be that the objects are just not concurrent enough.
        Specified by:
        getMaxRetries in interface TxnConfig
        Returns:
        the maxRetries.
        See Also:
        TxnFactoryBuilder.setMaxRetries(int)
      • updateSpeculativeConfigurationToUseNonRefType

        public void updateSpeculativeConfigurationToUseNonRefType()
      • updateSpeculativeConfigurationToUseListeners

        public void updateSpeculativeConfigurationToUseListeners()
      • updateSpeculativeConfigureToUseAbortOnly

        public void updateSpeculativeConfigureToUseAbortOnly()
      • updateSpeculativeConfigurationToUseCommute

        public void updateSpeculativeConfigurationToUseCommute()
      • updateSpeculativeConfigurationToUseExplicitLocking

        public void updateSpeculativeConfigurationToUseExplicitLocking()
      • updateSpeculativeConfigurationToUseConstructedObjects

        public void updateSpeculativeConfigurationToUseConstructedObjects()
      • updateSpeculativeConfigurationToUseRichMansConflictScan

        public void updateSpeculativeConfigurationToUseRichMansConflictScan()
      • updateSpeculativeConfigurationToUseMinimalTransactionLength

        public void updateSpeculativeConfigurationToUseMinimalTransactionLength​(int newLength)
      • updateSpeculativeConfigurationToUseEnsure

        public void updateSpeculativeConfigurationToUseEnsure()
      • setTimeoutNs

        public GammaTxnConfig setTimeoutNs​(long timeoutNs)
      • setMaxRetries

        public GammaTxnConfig setMaxRetries​(int maxRetries)
      • setMaximumPoorMansConflictScanLength

        public GammaTxnConfig setMaximumPoorMansConflictScanLength​(int maximumPoorMansConflictScanLength)
      • setReadTrackingEnabled

        public GammaTxnConfig setReadTrackingEnabled​(boolean trackReads)
      • setSpeculative

        public GammaTxnConfig setSpeculative​(boolean speculativeConfigEnabled)
      • setReadonly

        public GammaTxnConfig setReadonly​(boolean readonly)
      • setDirtyCheckEnabled

        public GammaTxnConfig setDirtyCheckEnabled​(boolean dirtyCheck)
      • setBlockingAllowed

        public GammaTxnConfig setBlockingAllowed​(boolean blockingAllowed)
      • setInterruptible

        public GammaTxnConfig setInterruptible​(boolean interruptible)
      • setControlFlowErrorsReused

        public GammaTxnConfig setControlFlowErrorsReused​(boolean controlFlowErrorsReused)
      • setSpinCount

        public GammaTxnConfig setSpinCount​(int spinCount)