- Type Parameters:
C- the generic type of the connections to be handled
- All Known Subinterfaces:
CachedConnectionProvider<C>,PoolingConnectionProvider<C>
Handles connections of the generic
Connection type, which are created from a configuration object of the generic type
Config.
Providers centralize the logic and parametrization to provision and release connection, while remaining abstracted from the concerns of actually manage those connections.
Implementations are expected to be reusable and thread-safe.
It is valid for implementations to implement any of the lifecycle interfaces or to request external dependencies through any of the JSR-330 annotations. However, implementations are not propagate lifecycle or to perform dependency injection into the generated connections. The runtime will do that automatically at the proper time.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionconnect()Creates a new connection.voiddisconnect(C connection) Disposes the givenconnection, freeing all its allocated resourcesValidates the givenConnectionProvider.
-
Method Details
-
connect
Creates a new connection.The returned connection is expected to be ready to use
- Returns:
- a ready to use
Connection - Throws:
org.mule.runtime.api.connection.ConnectionException
-
disconnect
Disposes the givenconnection, freeing all its allocated resources- Parameters:
connection- a nonnullConnection.
-
validate
Validates the givenConnectionProvider. In invalid connection case, theConnectionValidationResultshould also return a valid messageConnectionValidationResult.getMessage(), exceptionConnectionValidationResult.getException()and codeConnectionValidationResult.getErrorType()- Parameters:
connection- a nonnullConnectionProvider.- Returns:
- a
ConnectionValidationResultindicating if the connection is valid or not.
-