Interface TxnConfig

  • All Known Implementing Classes:
    GammaTxnConfig

    public interface TxnConfig
    Contains the transaction configuration used by a Txn. In the beginning this was all placed in the Txn, adding a lot of 'informational' methods to the transaction and therefor complicating its usage. So all the configurational properties of the transaction are contained in this structure.

    The same TxnConfig is used for multiple transactions. Each TxnFactory has just a single configuration and all Transactions created by that TxnFactory, share that configuration.

    • Method Detail

      • getStm

        Stm getStm()
        Returns the Stm that creates transactions based on this configuration.
        Returns:
        the stm.
      • isControlFlowErrorsReused

        boolean isControlFlowErrorsReused()
        Checks if the ControlFlowError is cached or a new one is used.

        Exception creation can be very expensive, so by default the ControlFlowError is reused, but this can be problematic when debugging.

        Returns:
        true if the ControlFlowError is reused.
        See Also:
        TxnFactoryBuilder.setControlFlowErrorsReused(boolean)
      • getTimeoutNs

        long getTimeoutNs()
        Returns the total timeout in nanoseconds. Long.MAX_VALUE indicates that there is no timeout.
        Returns:
        the total remaining timeout.
        See Also:
        TxnFactoryBuilder.setTimeoutNs(long)
      • isSpeculative

        boolean isSpeculative()
        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.
        Returns:
        true if speculative configuration is enabled.
        See Also:
        TxnFactoryBuilder.setSpeculative(boolean)
      • getFamilyName

        java.lang.String getFamilyName()
        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.
        Returns:
        the familyName. The returned value can be null.
        See Also:
        TxnFactoryBuilder.setFamilyName(String)
      • isReadonly

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

        int getSpinCount()
        Returns the maximum number of times the transaction is allowed to spin on a read to become readable (perhaps it is locked).
        Returns:
        the maximum number of spins
        See Also:
        TxnFactoryBuilder.setSpinCount(int)
      • isDirtyCheckEnabled

        boolean isDirtyCheckEnabled()
        Checks if dirty check is enabled on writes when a transaction commits. Turning of saves time, but forces writes that cause no change.
        Returns:
        true of dirty check is enabled.
        See Also:
        TxnFactoryBuilder.setDirtyCheckEnabled(boolean)
      • isReadTrackingEnabled

        boolean isReadTrackingEnabled()
        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.
        Returns:
        true if the transaction does automatic read tracking, false otherwise.
        See Also:
        TxnFactoryBuilder.setReadTrackingEnabled(boolean)
      • isBlockingAllowed

        boolean isBlockingAllowed()
        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.
        Returns:
        true if explicit retry is allowed, false otherwise.
        See Also:
        TxnFactoryBuilder.setBlockingAllowed(boolean)
      • isInterruptible

        boolean isInterruptible()
        Checks if the Txn can be interrupted if it is blocking.
        Returns:
        true if the Txn can be interrupted if it is blocking, false otherwise.
        See Also:
        TxnFactoryBuilder.setInterruptible(boolean)
      • getMaxRetries

        int getMaxRetries()
        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.
        Returns:
        the maxRetries.
        See Also:
        TxnFactoryBuilder.setMaxRetries(int)