diff --git a/jOOQ/src/main/java/org/jooq/ConnectionProvider.java b/jOOQ/src/main/java/org/jooq/ConnectionProvider.java index 7d6b6b714b..537457cfda 100644 --- a/jOOQ/src/main/java/org/jooq/ConnectionProvider.java +++ b/jOOQ/src/main/java/org/jooq/ConnectionProvider.java @@ -44,9 +44,9 @@ import org.jooq.exception.DataAccessException; *
* The ConnectionProvider allows for abstracting the handling of
* custom Connection lifecycles outside of jOOQ, injecting
- * behaviour into jOOQ's internals. jOOQ will try to get a new JDBC
+ * behaviour into jOOQ's internals. jOOQ will try to acquire a new JDBC
* {@link Connection} from the connection provider as early as needed, and will
- * return it as early as possible.
+ * release it as early as possible.
*
* @author Aaron Digulla
* @author Lukas Eder
@@ -54,24 +54,35 @@ import org.jooq.exception.DataAccessException;
public interface ConnectionProvider {
/**
- * Acquire a connection from the connection lifecycle handler
+ * Acquire a connection from the connection lifecycle handler.
*
- * The general contract is that a ConnectionProvider is
- * expected to always return the same connection, until this connection is
- * returned by jOOQ through {@link #release(Connection)}.
+ * This method is called by jOOQ exactly once per execution lifecycle, i.e.
+ * per {@link ExecuteContext}. Implementations may freely chose, whether
+ * subsequent calls to this method:
+ *
javax.transaction.UserTransaction)
+ * jOOQ will guarantee that every acquired connection is released through
+ * {@link #release(Connection)} exactly once.
*
+ * @return A connection for the current ExecuteContext.
* @throws DataAccessException If anything went wrong while acquiring a
* connection
*/
Connection acquire() throws DataAccessException;
/**
- * Release a connection to the connection lifecycle handler
+ * Release a connection to the connection lifecycle handler.
*
- * The general contract is that a ConnectionProvider must not
- * generate a new connection in {@link #acquire()}, before a previous
- * connection is returned.
+ * jOOQ will guarantee that every acquired connection is released exactly
+ * once.
*
+ * @param A connection that was previously obtained from {@link #acquire()}
* @throws DataAccessException If anything went wrong while releasing a
* connection
*/