Package io.higson.runtime.dao.util
Interface ConnectionInterceptor
- All Known Implementing Classes:
StdConnectionInterceptor
public interface ConnectionInterceptor
An interceptor for managing connections to
dataSource. Used internally by Higson for getting/releasing connection.
Defined by HigsonEngineFactory, and used within MiniJdbcTemplate.
Each connection to database, that was established getConnection(DataSource) and used, should be released
afterwards releaseConnection(Connection).
Created by psikora on 2017-01-18.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetConnection(@NotNull DataSource dataSource) Attempts to establish a connection with the givendataSource.voidreleaseConnection(Connection connection) Close the givenconnectionthat was established toDataSource.
-
Method Details
-
getConnection
Attempts to establish a connection with the givendataSource.- Parameters:
dataSource- data source for which connection should be established. Can't be null.- Returns:
- a connection to the data source
- Throws:
SQLException- if a database access error occurs
-
releaseConnection
Close the givenconnectionthat was established toDataSource.- Parameters:
connection- Connection to close. Ifnull, then nothing happens- See Also:
-