ConnectionFactoryUtils
instead.@Deprecated public abstract class ConnectionFactoryUtils extends Object
ConnectionFactory
.
Used internally by Spring's DatabaseClient
, Spring's R2DBC operation
objects. Can also be used directly in application code.
Modifier and Type | Field and Description |
---|---|
static int |
CONNECTION_SYNCHRONIZATION_ORDER
Deprecated.
Order value for ReactiveTransactionSynchronization objects that clean up R2DBC Connections.
|
Modifier and Type | Method and Description |
---|---|
static reactor.core.publisher.Mono<Void> |
closeConnection(Connection connection,
ConnectionFactory connectionFactory)
Deprecated.
Close the
Connection . |
static reactor.core.publisher.Mono<ConnectionFactory> |
currentConnectionFactory(ConnectionFactory connectionFactory)
Deprecated.
Obtain the
ConnectionFactory from the current subscriber Context . |
static reactor.core.publisher.Mono<Void> |
doCloseConnection(Connection connection,
ConnectionFactory connectionFactory)
Deprecated.
Close the
Connection , unless a SmartConnectionFactory doesn't want us to. |
static reactor.core.publisher.Mono<Connection> |
doGetConnection(ConnectionFactory connectionFactory)
Deprecated.
Actually obtain a R2DBC Connection from the given
ConnectionFactory . |
static reactor.core.publisher.Mono<Void> |
doReleaseConnection(Connection connection,
ConnectionFactory connectionFactory)
Deprecated.
Actually close the given
Connection , obtained from the given
ConnectionFactory . |
static reactor.core.publisher.Mono<Connection> |
getConnection(ConnectionFactory connectionFactory)
Deprecated.
Obtain a
Connection from the given ConnectionFactory . |
static Connection |
getTargetConnection(Connection con)
Deprecated.
Return the innermost target
Connection of the given Connection . |
static reactor.core.publisher.Mono<Void> |
releaseConnection(Connection con,
ConnectionFactory connectionFactory)
Deprecated.
Close the given
Connection , obtained from the given ConnectionFactory , if
it is not managed externally (that is, not bound to the thread). |
public static final int CONNECTION_SYNCHRONIZATION_ORDER
public static reactor.core.publisher.Mono<Connection> getConnection(ConnectionFactory connectionFactory)
Connection
from the given ConnectionFactory
. Translates
exceptions into the Spring hierarchy of unchecked generic data access exceptions, simplifying calling code and
making any exception that is thrown more meaningful.
Is aware of a corresponding Connection bound to the current Context
. Will bind a
Connection to the Context
if transaction synchronization is active.
connectionFactory
- the ConnectionFactory
to obtain Connections
from.ConnectionFactory
.DataAccessResourceFailureException
- if the attempt to get a Connection
failed.releaseConnection(io.r2dbc.spi.Connection, io.r2dbc.spi.ConnectionFactory)
public static reactor.core.publisher.Mono<Connection> doGetConnection(ConnectionFactory connectionFactory)
ConnectionFactory
. Same as
getConnection(io.r2dbc.spi.ConnectionFactory)
, but preserving the original exceptions.
Is aware of a corresponding Connection bound to the current Context
. Will bind a
Connection to the Context
if transaction synchronization is active.
connectionFactory
- the ConnectionFactory
to obtain Connections from.Connection
from the given ConnectionFactory
.public static reactor.core.publisher.Mono<Void> releaseConnection(Connection con, ConnectionFactory connectionFactory)
Connection
, obtained from the given ConnectionFactory
, if
it is not managed externally (that is, not bound to the thread).con
- the Connection
to close if necessary.connectionFactory
- the ConnectionFactory
that the Connection was obtained from.getConnection(io.r2dbc.spi.ConnectionFactory)
public static reactor.core.publisher.Mono<Void> doReleaseConnection(Connection connection, ConnectionFactory connectionFactory)
Connection
, obtained from the given
ConnectionFactory
. Same as releaseConnection(io.r2dbc.spi.Connection, io.r2dbc.spi.ConnectionFactory)
, but preserving the original exception.connection
- the Connection
to close if necessary.connectionFactory
- the ConnectionFactory
that the Connection was obtained from.doGetConnection(io.r2dbc.spi.ConnectionFactory)
public static reactor.core.publisher.Mono<Void> closeConnection(Connection connection, ConnectionFactory connectionFactory)
Connection
. Translates exceptions into the Spring hierarchy of unchecked generic
data access exceptions, simplifying calling code and making any exception that is thrown more meaningful.connection
- the Connection
to close.connectionFactory
- the ConnectionFactory
that the Connection
was
obtained from.ConnectionFactory
.DataAccessResourceFailureException
- if the attempt to get a Connection
failedpublic static reactor.core.publisher.Mono<Void> doCloseConnection(Connection connection, @Nullable ConnectionFactory connectionFactory)
Connection
, unless a SmartConnectionFactory
doesn't want us to.connection
- the Connection
to close if necessary.connectionFactory
- the ConnectionFactory
that the Connection was obtained from.Connection.close()
,
SmartConnectionFactory.shouldClose(Connection)
public static reactor.core.publisher.Mono<ConnectionFactory> currentConnectionFactory(ConnectionFactory connectionFactory)
ConnectionFactory
from the current subscriber Context
.connectionFactory
- the ConnectionFactory
that the Connection was obtained from.TransactionSynchronizationManager
public static Connection getTargetConnection(Connection con)
Connection
of the given Connection
. If the
given Connection
is a proxy, it will be unwrapped until a non-proxy
Connection
is found. Otherwise, the passed-in Connection will be returned as-is.con
- the Connection
proxy to unwrapConnectionProxy.getTargetConnection()
Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.