ConnectionFactory.
Used internally by Spring's DatabaseClient, Spring's R2DBC operation
objects. Can also be used directly in application code.
R2dbcTransactionManager, org.springframework.transaction.reactive.TransactionSynchronizationManager
| Modifier and Type | Class and Description |
|---|---|
| private static class | ConnectionFactoryUtils.
Callback for resource cleanup at the end of a non-native R2DBC transaction. |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | CONNECTION_SYNCHRONIZATION_ORDER
Order value for ReactiveTransactionSynchronization objects that clean up R2DBC Connections. |
| private static final Set |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static String | Returns: the messageString to usereadable text describing the task being attempted task, String the SQL statement that caused the problem sql, R2dbcException the offending ex)R2dbcExceptionBuild a message |
| private static boolean | Returns: whether the given Connections are equalthe conHolder, Connection ConnectionHolder for the held Connection (potentially a proxy)the passedInCon)Connection passed-in by the user (potentially
a target Connection without proxy).Determine whether the given two |
| public static DataAccessException | Returns: the corresponding DataAccessException instancereadable text describing the task being attempted task, String the SQL query or update that caused the problem (if known) sql, R2dbcException the offending ex)R2dbcExceptionTranslate the given |
| public static Mono | currentConnectionFactory(ConnectionFactory
the connectionFactory)ConnectionFactory that the Connection was obtained fromObtain the |
| public static Mono | doGetConnection(ConnectionFactory
the connectionFactory)ConnectionFactory to obtain Connections fromActually obtain a R2DBC Connection from the given |
| public static Mono | doReleaseConnection(Connection
the connection, ConnectionFactory Connection to close if necessarythe connectionFactory)ConnectionFactory that the Connection was obtained fromActually close the given |
| private static Mono | fetchConnection(ConnectionFactory
the connectionFactory)ConnectionFactory to obtain
Connections fromActually fetch a |
| public static Mono | Returns: a R2DBC Connection from the givenConnectionFactorythe connectionFactory)ConnectionFactory to obtain
Connections fromObtain a |
| private static int | Returns: the connection synchronization order to usethe connectionFactory)ConnectionFactory to checkDetermine the connection synchronization order to use for the given |
| public static Connection | Returns: the innermost target Connection, or the passed-in one if not wrappedthe con)Connection wrapper to unwrapReturn the innermost target |
| pack-priv static boolean | indicatesDuplicateKey(String
the SQL state value sqlState, int the error code errorCode)Check whether the given SQL state and the associated error code (in case of a generic SQL state value) indicate a duplicate key exception: either SQL state 23505 as a specific indication, or the generic SQL state 23000 with a well-known vendor code. |
| public static Mono | releaseConnection(Connection
the con, ConnectionFactory Connection to close if necessarythe connectionFactory)ConnectionFactory that the Connection was obtained fromClose the given |
| CONNECTION_SYNCHRONIZATION_ORDER | back to summary |
|---|---|
| public static final int CONNECTION_SYNCHRONIZATION_ORDER Order value for ReactiveTransactionSynchronization objects that clean up R2DBC Connections. | |
| DUPLICATE_KEY_ERROR_CODES | back to summary |
|---|---|
| private static final Set<Integer> DUPLICATE_KEY_ERROR_CODES | |
| ConnectionFactoryUtils | back to summary |
|---|---|
| public ConnectionFactoryUtils() | |
| buildMessage | back to summary |
|---|---|
| private static String buildMessage(String task, String sql, R2dbcException ex) Build a message To be called by translator subclasses when creating an instance of a generic
| |
| connectionEquals | back to summary |
|---|---|
| private static boolean connectionEquals(ConnectionHolder conHolder, Connection passedInCon) Determine whether the given two
| |
| convertR2dbcException | back to summary |
|---|---|
| public static DataAccessException convertR2dbcException(String task, String sql, R2dbcException ex) Translate the given The returned DataAccessException is supposed to contain the original
| |
| currentConnectionFactory | back to summary |
|---|---|
| public static Mono Obtain the
| |
| doGetConnection | back to summary |
|---|---|
| public static Mono Actually obtain a R2DBC Connection from the given Is aware of a corresponding Connection bound to the current
| |
| doReleaseConnection | back to summary |
|---|---|
| public static Mono Actually close the given
| |
| fetchConnection | back to summary |
|---|---|
| private static Mono Actually fetch a
| |
| getConnection | back to summary |
|---|---|
| public static Mono Obtain a Is aware of a corresponding Connection bound to the current
| |
| getConnectionSynchronizationOrder | back to summary |
|---|---|
| private static int getConnectionSynchronizationOrder(ConnectionFactory connectionFactory) Determine the connection synchronization order to use for the given
| |
| getTargetConnection | back to summary |
|---|---|
| public static Connection getTargetConnection(Connection con) Return the innermost target
| |
| indicatesDuplicateKey | back to summary |
|---|---|
| pack-priv static boolean indicatesDuplicateKey(String sqlState, int errorCode) Check whether the given SQL state and the associated error code (in case of a generic SQL state value) indicate a duplicate key exception: either SQL state 23505 as a specific indication, or the generic SQL state 23000 with a well-known vendor code.
| |
| releaseConnection | back to summary |
|---|---|
| public static Mono Close the given
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ConnectionFactory | |
| private final ConnectionHolder | |
| private boolean | |
| private final int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Mono | afterCompletion(int
completion status according to the status)STATUS_* constantsOverrides default org. Invoked after transaction commit/rollback. |
| public Mono | beforeCompletion()
Overrides default org. Invoked before transaction commit/rollback. |
| public int | |
| public Mono | resume()
Overrides default org. Resume this synchronization. |
| public Mono | suspend()
Overrides default org. Suspend this synchronization. |
| connectionFactory | back to summary |
|---|---|
| private final ConnectionFactory connectionFactory | |
| connectionHolder | back to summary |
|---|---|
| private final ConnectionHolder connectionHolder | |
| holderActive | back to summary |
|---|---|
| private boolean holderActive | |
| order | back to summary |
|---|---|
| private final int order | |
| ConnectionSynchronization | back to summary |
|---|---|
| pack-priv ConnectionSynchronization(ConnectionHolder connectionHolder, ConnectionFactory connectionFactory) | |
| afterCompletion | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Invoked after transaction commit/rollback. Can perform resource cleanup after transaction completion. Note The transaction will have been committed or rolled back already,
but the transactional resources might still be active and accessible. As a
consequence, any data access code triggered at this point will still "participate"
in the original transaction, allowing to perform some cleanup (with no commit
following anymore!), unless it explicitly declares that it needs to run in a
separate transaction. Hence: Use
| |
| beforeCompletion | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Invoked before transaction commit/rollback. Can perform resource cleanup before transaction completion. This method will be invoked after
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. Get the order value of this object. Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet Same order values will result in arbitrary sort positions for the affected objects.
| |
| resume | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Resume this synchronization. Supposed to rebind resources to TransactionSynchronizationManager if managing any.
| |
| suspend | back to summary |
|---|---|
| public Mono Overrides default org. Doc from org. Suspend this synchronization. Supposed to unbind resources from TransactionSynchronizationManager if managing any.
| |