- All Known Implementing Classes:
public interface ConnectionProviderA connection lifecycle handler API.
ConnectionProviderallows for abstracting the handling of custom
Connectionlifecycles outside of jOOQ, injecting behaviour into jOOQ's internals. jOOQ will try to acquire a new JDBC
Connectionfrom the connection provider as early as needed, and will release it as early as possible.
TransactionProviderimplementations may choose to influence
ConnectionProviderbehaviour, e.g. by acquiring connections upon
TransactionProvider.begin(TransactionContext)and by releasing connections only upon
- Aaron Digulla, Lukas Eder
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
acquire()Acquire a connection from the connection lifecycle handler.
release(Connection connection)Release a connection to the connection lifecycle handler.
Connection acquire() throws DataAccessExceptionAcquire a connection from the connection lifecycle handler.
This method is called by jOOQ exactly once per execution lifecycle, i.e. per
ExecuteContext. Implementations may freely chose, whether subsequent calls to this method:
- return the same connection instance
- return the same connection instance for the same thread
- return the same connection instance for the same transaction (e.g. a
- return a fresh connection instance every time
jOOQ will guarantee that every acquired connection is released through
- A connection for the current
DataAccessException- If anything went wrong while acquiring a connection
void release(Connection connection) throws DataAccessExceptionRelease a connection to the connection lifecycle handler.
jOOQ will guarantee that every acquired connection is released exactly once.
connection- A connection that was previously obtained from
acquire(). This is never
DataAccessException- If anything went wrong while releasing a connection