public class ConnectionPluginManager extends java.lang.Object implements ITransactionContextHandler
IConnectionPlugin
for each connection.Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
DEFAULT_PLUGIN_FACTORIES |
protected IConnectionPlugin |
headPlugin |
protected Log |
logger |
protected PropertySet |
propertySet |
Constructor and Description |
---|
ConnectionPluginManager(Log logger) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
execute(java.lang.Class<?> methodInvokeOn,
java.lang.String methodName,
java.util.concurrent.Callable<?> executeSqlFunc,
java.lang.Object[] args)
Execute a JDBC method with the connection plugin chain.
|
void |
init(ICurrentConnectionProvider currentConnectionProvider,
PropertySet propertySet)
Initialize a chain of
IConnectionPlugin using their corresponding IConnectionPluginFactory . |
void |
openInitialConnection(ConnectionUrl connectionUrl) |
void |
releaseResources()
Release all dangling resources held by the connection plugins associated with
a single connection.
|
void |
transactionBegun()
Called when the driver has been told by the server that a transaction is now in progress (when
one has not been currently in progress).
|
void |
transactionCompleted()
Called when the driver has been told by the server that a transaction has completed, and no
transaction is currently in progress.
|
protected static final java.lang.String DEFAULT_PLUGIN_FACTORIES
protected Log logger
protected PropertySet propertySet
protected IConnectionPlugin headPlugin
public ConnectionPluginManager(Log logger)
public void init(ICurrentConnectionProvider currentConnectionProvider, PropertySet propertySet) throws java.sql.SQLException
IConnectionPlugin
using their corresponding IConnectionPluginFactory
.
If PropertyKey.connectionPluginFactories
is provided by the user, initialize
the chain with the given connection plugins in the order they are specified. Otherwise,
initialize the NodeMonitoringConnectionPlugin
instead.
The DefaultConnectionPlugin
will always be initialized and attached as the
last connection plugin in the chain.
currentConnectionProvider
- The connection the plugins are associated with.propertySet
- The configuration of the connection.java.sql.SQLException
public java.lang.Object execute(java.lang.Class<?> methodInvokeOn, java.lang.String methodName, java.util.concurrent.Callable<?> executeSqlFunc, java.lang.Object[] args) throws java.lang.Exception
methodInvokeOn
- The Java Class invoking the JDBC method.methodName
- The name of the method being invoked.executeSqlFunc
- A lambda executing the method.java.lang.Exception
- if errors occurred during the execution.public void releaseResources()
public void openInitialConnection(ConnectionUrl connectionUrl) throws java.sql.SQLException
java.sql.SQLException
public void transactionBegun()
ITransactionContextHandler
transactionBegun
in interface ITransactionContextHandler
public void transactionCompleted()
ITransactionContextHandler
transactionCompleted
in interface ITransactionContextHandler