Class SpeculativeConfigurationError

  • All Implemented Interfaces:
    java.io.Serializable

    public class SpeculativeConfigurationError
    extends ControlFlowError
    A ControlFlowError thrown for dealing with the speculative configuration mechanism.

    Multiverse uses a speculative configuration mechanism if enabled makes certain optimizations possible. E.g. one of the optimizations is to use different Txn implementations that are optimized for certain transaction lengths. As long as the speculation is not violated, you will get better performance than when a more heavy weight transaction/configuration.

    So ControlFlowErrors are not something bad, but just a way for the STM to figure out what the cheapest settings are for performance/scalability.

    Unexpected retries

    Because a transaction can fail on a speculative failure more than once, it could be that the transaction is retried. Normally this is not an issue, since the transaction will be retried, so is invisible. And once the TxnExecutor has learned, it will not make the same mistakes again, but if you do io (e.g. print to the System.out or do logging) you can expect to see aborts, even though there is no other reason to. Speculative behavior can be turned of (either on the Txn or STM level) but you will not get the best out of performance. For the speculative behavior to learn, it is important that the TxnExecutor is reused.

    See Also:
    TxnFactoryBuilder.setSpeculative(boolean), Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      SpeculativeConfigurationError​(boolean fillStackTrace)
      Creates a SpeculativeConfigurationError.
      SpeculativeConfigurationError​(java.lang.String message)
      Creates a SpeculativeConfigurationError with the provided message.
      SpeculativeConfigurationError​(java.lang.String message, java.lang.Throwable cause)
      Creates a SpeculativeConfigurationError with the provided message and cause.
    • Method Summary

      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SpeculativeConfigurationError

        public SpeculativeConfigurationError​(boolean fillStackTrace)
        Creates a SpeculativeConfigurationError.
        Parameters:
        fillStackTrace - if the StackTrace should be filled.
      • SpeculativeConfigurationError

        public SpeculativeConfigurationError​(java.lang.String message)
        Creates a SpeculativeConfigurationError with the provided message.
        Parameters:
        message - the message of the exception.
      • SpeculativeConfigurationError

        public SpeculativeConfigurationError​(java.lang.String message,
                                             java.lang.Throwable cause)
        Creates a SpeculativeConfigurationError with the provided message and cause.
        Parameters:
        message - the message of the exception.
        cause - the cause of the exception.