Package org.jdbi.v3.core.transaction
Class SerializableTransactionRunner.Configuration
java.lang.Object
org.jdbi.v3.core.transaction.SerializableTransactionRunner.Configuration
- All Implemented Interfaces:
JdbiConfig<SerializableTransactionRunner.Configuration>
- Enclosing class:
SerializableTransactionRunner
public static class SerializableTransactionRunner.Configuration
extends Object
implements JdbiConfig<SerializableTransactionRunner.Configuration>
Configuration for serializable transaction runner.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this configuration object.setMaxRetries
(int maxRetries) Sets the maximum number of retry attempts before aborting.setOnFailure
(Consumer<List<Exception>> onFailure) Set a consumer that is called with a list of exceptions during a run.setOnSuccess
(Consumer<List<Exception>> onSuccess) Sets a consumer that is called after a run has completed successfully.setSerializationFailureSqlState
(String serializationFailureSqlState) Sets the SQL state to consider as a serialization failure.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jdbi.v3.core.config.JdbiConfig
setRegistry
-
Constructor Details
-
Configuration
public Configuration()
-
-
Method Details
-
setMaxRetries
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(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(Consumer<List<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(Consumer<List<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
-
createCopy
Description copied from interface:JdbiConfig
Returns a copy of this configuration object. Changes to the copy should not modify the original, and vice-versa.- Specified by:
createCopy
in interfaceJdbiConfig<SerializableTransactionRunner.Configuration>
- Returns:
- a copy of this configuration object.
-