open class SingleConnectionFactory : DelegatingConnectionFactory, DisposableBean
A CCI ConnectionFactory adapter that returns the same Connection on all getConnection
calls, and ignores calls to Connection.close()
.
Useful for testing and standalone environments, to keep using the same Connection for multiple CciTemplate calls, without having a pooling ConnectionFactory, also spanning any number of transactions.
You can either pass in a CCI Connection directly, or let this factory lazily create a Connection via a given target ConnectionFactory.
Author
Juergen Hoeller
Since
1.2
See Also
#getConnection()javax.resource.cci.Connection#close()org.springframework.jca.cci.core.CciTemplate
SingleConnectionFactory()
Create a new SingleConnectionFactory for bean-style usage. SingleConnectionFactory(target: Connection)
Create a new SingleConnectionFactory that always returns the given Connection. SingleConnectionFactory(targetConnectionFactory: ConnectionFactory)
Create a new SingleConnectionFactory that always returns a single Connection which it will lazily create via the given target ConnectionFactory. |
open fun afterPropertiesSet(): Unit
Make sure a Connection or ConnectionFactory has been set. |
|
open fun destroy(): Unit
Close the underlying Connection. The provider of this ConnectionFactory needs to care for proper shutdown. As this bean implements DisposableBean, a bean factory will automatically invoke this on destruction of its cached singletons. |
|
open fun getConnection(): Connection open fun getConnection(connectionSpec: ConnectionSpec): Connection |
|
open fun initConnection(): Unit
Initialize the single underlying Connection. Closes and reinitializes the Connection if an underlying Connection is present already. |
|
open fun resetConnection(): Unit
Reset the underlying shared Connection, to be reinitialized on next access. |