Class SerializableTransactionRunner.Configuration

    • Field Detail

      • NOP

        private static final java.util.function.Consumer<java.util.List<java.lang.Exception>> NOP
      • maxRetries

        private int maxRetries
      • serializationFailureSqlState

        private java.lang.String serializationFailureSqlState
      • onFailure

        private java.util.function.Consumer<java.util.List<java.lang.Exception>> onFailure
      • onSuccess

        private java.util.function.Consumer<java.util.List<java.lang.Exception>> onSuccess
    • Method Detail

      • setMaxRetries

        public SerializableTransactionRunner.Configuration setMaxRetries​(int maxRetries)
        Sets the maximum number of retry attempts before aborting.
        Parameters:
        maxRetries - The maximum number of retry attempts before aborting.
        Returns:
        this
      • setSerializationFailureSqlState

        public SerializableTransactionRunner.Configuration setSerializationFailureSqlState​(java.lang.String serializationFailureSqlState)
        Sets the SQL state to consider as a serialization failure.
        Parameters:
        serializationFailureSqlState - the SQL state to consider as a serialization failure.
        Returns:
        this
      • setOnFailure

        public SerializableTransactionRunner.Configuration setOnFailure​(java.util.function.Consumer<java.util.List<java.lang.Exception>> onFailure)
        Set a consumer that is called with a list of exceptions during a run. Will not be called with any exceptions that are not the configured serialization failure. These will simply be thrown, aborting the operation. Can be used e.g. for logging.
        Parameters:
        onFailure - A consumer to handle failures. Will never be called with Exceptions that have not been configured.
        Returns:
        this
      • setOnSuccess

        public SerializableTransactionRunner.Configuration setOnSuccess​(java.util.function.Consumer<java.util.List<java.lang.Exception>> onSuccess)
        Sets a consumer that is called after a run has completed successfully. The consumer will received any exceptions that happened during the run. Will not be called with any exceptions that are not the configured serialization failure. This can be used to e.g. log all exceptions after a successful run.
        Parameters:
        onSuccess - A consumer to handle the list of failures after the run has been completed successfully.
        Returns:
        this