public class ConnectionHolder extends ResourceHolderSupport
Connection.
R2dbcTransactionManager binds instances of this class to the subscription,
for a specific ConnectionFactory.
Inherits rollback-only support for nested R2DBC transactions and reference count functionality from the base class.
Note: This is an SPI class, not intended to be used by applications.
R2dbcTransactionManager,
ConnectionFactoryUtils| Constructor and Description |
|---|
ConnectionHolder(Connection connection)
Create a new ConnectionHolder for the given R2DBC
Connection,
assuming that there is no ongoing transaction. |
ConnectionHolder(Connection connection,
boolean transactionActive)
Create a new ConnectionHolder for the given R2DBC
Connection. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the transactional state of this resource holder.
|
Connection |
getConnection()
Return the current
Connection held by this ConnectionHolder. |
protected boolean |
hasConnection()
Return whether this holder currently has a
Connection. |
protected boolean |
isTransactionActive()
Return whether this holder represents an active, R2DBC-managed transaction.
|
void |
released()
Releases the current
Connection. |
protected void |
setConnection(Connection connection)
Override the existing Connection with the given
Connection. |
protected void |
setTransactionActive(boolean transactionActive)
Set whether this holder represents an active, R2DBC-managed transaction.
|
getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, requested, reset, resetRollbackOnly, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unboundpublic ConnectionHolder(Connection connection)
Connection,
assuming that there is no ongoing transaction.connection - the R2DBC Connection to holdConnectionHolder(Connection, boolean)public ConnectionHolder(Connection connection, boolean transactionActive)
Connection.connection - the R2DBC Connection to holdtransactionActive - whether the given Connection is involved
in an ongoing transactionprotected boolean hasConnection()
Connection.protected void setTransactionActive(boolean transactionActive)
R2dbcTransactionManagerprotected boolean isTransactionActive()
protected void setConnection(@Nullable Connection connection)
Connection.
Used for releasing the Connection on suspend
(with a null argument) and setting a fresh Connection on resume.
public Connection getConnection()
Connection held by this ConnectionHolder.
This will be the same Connection until released gets called
on the ConnectionHolder, which will reset the held Connection,
fetching a new Connection on demand.
released()public void released()
Connection.released in class ResourceHolderSupportpublic void clear()
ResourceHolderSupportclear in class ResourceHolderSupport