public class NodeMonitoringConnectionPlugin extends java.lang.Object implements IConnectionPlugin
Modifier and Type | Field and Description |
---|---|
protected Log |
logger |
protected IConnectionPlugin |
nextPlugin |
protected PropertySet |
propertySet |
Constructor and Description |
---|
NodeMonitoringConnectionPlugin(ICurrentConnectionProvider currentConnectionProvider,
PropertySet propertySet,
IConnectionPlugin nextPlugin,
Log logger)
Initialize the node monitoring plugin.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
doesNeedMonitoring(java.lang.Class<?> methodInvokeOn,
java.lang.String methodName)
Checks whether the JDBC method passed to this connection plugin requires monitoring.
|
java.lang.Object |
execute(java.lang.Class<?> methodInvokeOn,
java.lang.String methodName,
java.util.concurrent.Callable<?> executeSqlFunc,
java.lang.Object[] args)
Executes the given SQL function with
Monitor if connection monitoring is enabled. |
void |
openInitialConnection(ConnectionUrl connectionUrl) |
void |
releaseResources()
Call this plugin's monitor service to release all resources associated with this
plugin.
|
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 IConnectionPlugin nextPlugin
protected Log logger
protected PropertySet propertySet
public NodeMonitoringConnectionPlugin(ICurrentConnectionProvider currentConnectionProvider, PropertySet propertySet, IConnectionPlugin nextPlugin, Log logger)
currentConnectionProvider
- A provider allowing the plugin to retrieve the
current active connection and its connection settings.propertySet
- The property set used to initialize the active connection.nextPlugin
- The next connection plugin in the chain.logger
- An implementation of Log
.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
Monitor
if connection monitoring is enabled.
Otherwise, executes the SQL function directly.execute
in interface IConnectionPlugin
methodInvokeOn
- Class of an object that method to monitor to be invoked on.methodName
- Name of the method to monitor.executeSqlFunc
- Callable
SQL function.args
- Arguments used to execute the given method.Callable
SQL function.java.lang.Exception
- if an error occurs.protected boolean doesNeedMonitoring(java.lang.Class<?> methodInvokeOn, java.lang.String methodName)
methodInvokeOn
- The class of the JDBC method.methodName
- Name of the JDBC method.public void transactionBegun()
ITransactionContextHandler
transactionBegun
in interface ITransactionContextHandler
public void transactionCompleted()
ITransactionContextHandler
transactionCompleted
in interface ITransactionContextHandler
public void openInitialConnection(ConnectionUrl connectionUrl) throws java.sql.SQLException
openInitialConnection
in interface IConnectionPlugin
java.sql.SQLException
public void releaseResources()
releaseResources
in interface IConnectionPlugin