Interface ConnectionFactory
- All Known Implementing Classes:
SpringConnectionFactory
,SpringConnectionFactory
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Supplies
Connection
instances to a created Handle
and allows
custom close handling.-
Method Summary
Modifier and TypeMethodDescriptiondefault void
closeConnection
(Connection conn) Closes a connection.default Cleanable
getCleanableFor
(Connection conn) Returns aCleanable
that will close the connection and release all necessary resources.Opens a connection.
-
Method Details
-
openConnection
Opens a connection.- Returns:
- A
Connection
object. - Throws:
SQLException
- if anything goes wrong
-
closeConnection
Closes a connection.- Parameters:
conn
- AConnection
object.- Throws:
SQLException
- if anything goes wrong
-
getCleanableFor
Returns aCleanable
that will close the connection and release all necessary resources. LikeConnection.close()
, the Cleanable should no-op if called more than once.- Parameters:
conn
- AConnection
object.- Returns:
- A
Cleanable
instance. Calling theCleanable.close()
method will close the connection and release all resources.
-