public class MockConnectionProvider extends Object implements ConnectionProvider
This ConnectionProvider
wraps a delegate
ConnectionProvider
and wraps all acquired Connection
references in MockConnection
.
Constructor and Description |
---|
MockConnectionProvider(ConnectionProvider delegate,
MockDataProvider provider) |
Modifier and Type | Method and Description |
---|---|
Connection |
acquire()
Acquire a connection from the connection lifecycle handler.
|
void |
release(Connection connection)
Release a connection to the connection lifecycle handler.
|
public MockConnectionProvider(ConnectionProvider delegate, MockDataProvider provider)
public final Connection acquire()
ConnectionProvider
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:
javax.transaction.UserTransaction
)
jOOQ will guarantee that every acquired connection is released through
ConnectionProvider.release(Connection)
exactly once.
acquire
in interface ConnectionProvider
ExecuteContext
. If
null
is returned (e.g. by NoConnectionProvider),
then statements cannot be executed. Attempts to execute
statements will result in a DetachedException
.public final void release(Connection connection)
ConnectionProvider
jOOQ will guarantee that every acquired connection is released exactly once.
release
in interface ConnectionProvider
connection
- A connection that was previously obtained from
ConnectionProvider.acquire()
. This is never null
.Copyright © 2021. All rights reserved.