ConnectionHolder
instead.@Deprecated public class ConnectionHolder extends ResourceHolderSupport
Connection
. R2dbcTransactionManager
binds instances of this class to
the thread, 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)
Deprecated.
Create a new ConnectionHolder for the given R2DBC
Connection , wrapping it with a
SimpleConnectionHandle , assuming that there is no ongoing transaction. |
ConnectionHolder(Connection connection,
boolean transactionActive)
Deprecated.
Create a new ConnectionHolder for the given R2DBC
Connection , wrapping it with a
SimpleConnectionHandle . |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Deprecated.
|
Connection |
getConnection()
Deprecated.
Return the current
Connection held by this ConnectionHolder . |
ConnectionHandle |
getConnectionHandle()
Deprecated.
Return the ConnectionHandle held by this ConnectionHolder.
|
protected boolean |
hasConnection()
Deprecated.
Return whether this holder currently has a
Connection . |
protected boolean |
isTransactionActive()
Deprecated.
Return whether this holder represents an active, R2DBC-managed transaction.
|
void |
released()
Deprecated.
Releases the current
Connection held by this ConnectionHolder . |
protected void |
setConnection(Connection connection)
Deprecated.
Override the existing Connection handle with the given
Connection . |
protected void |
setTransactionActive(boolean transactionActive)
Deprecated.
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, unbound
public ConnectionHolder(Connection connection)
Connection
, wrapping it with a
SimpleConnectionHandle
, assuming that there is no ongoing transaction.connection
- the R2DBC Connection
to holdSimpleConnectionHandle
,
ConnectionHolder(Connection, boolean)
public ConnectionHolder(Connection connection, boolean transactionActive)
Connection
, wrapping it with a
SimpleConnectionHandle
.connection
- the R2DBC Connection
to holdtransactionActive
- whether the given Connection
is involved in an ongoing transactionSimpleConnectionHandle
@Nullable public ConnectionHandle getConnectionHandle()
protected boolean hasConnection()
Connection
.protected void setTransactionActive(boolean transactionActive)
R2dbcTransactionManager
protected boolean isTransactionActive()
protected void setConnection(@Nullable Connection connection)
Connection
. Reset the handle if given
null.
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.
ConnectionHandle.getConnection()
,
released()
public void released()
Connection
held by this ConnectionHolder
.
This is necessary for ConnectionHandle
s that expect "Connection borrowing", where each returned
Connection
is only temporarily leased and needs to be returned once the data operation is done, to make the
Connection available for other operations within the same transaction.
released
in class ResourceHolderSupport
public void clear()
clear
in class ResourceHolderSupport
Copyright © 2018–2022 Pivotal Software, Inc.. All rights reserved.