Package io.micronaut.data.connection
Interface SynchronousConnectionManager<C>
- Type Parameters:
C
- The connection type
- All Known Implementing Classes:
AbstractConnectionOperations
,DefaultDataSourceConnectionOperations
,HibernateConnectionOperations
public interface SynchronousConnectionManager<C>
The synchronous connection manager.
The different from
ConnectionOperations
is that allows to open a connection and close it later.
It's recommended to use ConnectionOperations
is most of the cases.- Since:
- 4.0.0
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionvoid
complete
(@NonNull ConnectionStatus<C> status) Completes the connection.@NonNull ConnectionStatus<C>
getConnection
(@NonNull ConnectionDefinition definition) Opens or reuses the existing connection based on the definition.
-
Method Details
-
getConnection
@NonNull @NonNull ConnectionStatus<C> getConnection(@NonNull @NonNull ConnectionDefinition definition) Opens or reuses the existing connection based on the definition. It's required to callcomplete(ConnectionStatus)
after the connection is not needed anymore.- Parameters:
definition
- The connection definition.- Returns:
- The connection status
-
complete
Completes the connection. Closes it if the connection was open before.- Parameters:
status
- The connection status
-