public abstract class JdbcEventListener extends Object
This class intentionally is not an interface so that methods can be added without breaking existing implementations.
There are two ways to register your custom implementation of this class.
The fist way is to add the fully qualified class name of your implementation to
src/main/resources/META-INF/services/com.p6spy.engine.event.JdbcEventListener.
NOTE: Exceptions thrown in this event listener won't be caught. So you have to make sure that your event
listener does not throw exceptions. For example, if your onConnectionWrapped(com.codingapi.txlcn.tc.support.p6spy.common.ConnectionInformation) method throws an exception
your application won't be able to create any Connection.
| 构造器和说明 |
|---|
JdbcEventListener() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
onAfterAddBatch(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
SQLException e)
This callback method is executed after the
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked. |
void |
onAfterAddBatch(StatementInformation statementInformation,
long timeElapsedNanos,
String sql,
SQLException e)
This callback method is executed after the
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked. |
void |
onAfterCallableStatementSet(CallableStatementInformation statementInformation,
String parameterName,
Object value,
SQLException e)
This callback method is executed after any of the
CallableStatement.set* methods are invoked. |
void |
onAfterCommit(ConnectionInformation connectionInformation,
long timeElapsedNanos,
SQLException e)
This callback method is executed after the
Connection.commit() method is invoked. |
void |
onAfterConnectionClose(ConnectionInformation connectionInformation,
SQLException e)
This callback method is executed after the
Connection.close() method is invoked. |
void |
onAfterExecute(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
SQLException e)
This callback method is executed after any the
PreparedStatement.execute() methods are invoked. |
void |
onAfterExecute(StatementInformation statementInformation,
long timeElapsedNanos,
String sql,
SQLException e)
This callback method is executed after any the
Statement.execute(String) methods are invoked. |
void |
onAfterExecuteBatch(StatementInformation statementInformation,
long timeElapsedNanos,
int[] updateCounts,
SQLException e)
This callback method is executed after the
Statement.executeBatch() method is invoked. |
void |
onAfterExecuteQuery(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
SQLException e)
This callback method is executed after the
PreparedStatement.executeQuery() method is invoked. |
void |
onAfterExecuteQuery(StatementInformation statementInformation,
long timeElapsedNanos,
String sql,
SQLException e)
This callback method is executed after the
Statement.executeQuery(String) method is invoked. |
void |
onAfterExecuteUpdate(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
int rowCount,
SQLException e)
This callback method is executed after the
PreparedStatement.executeUpdate() method is invoked. |
void |
onAfterExecuteUpdate(StatementInformation statementInformation,
long timeElapsedNanos,
String sql,
int rowCount,
SQLException e)
This callback method is executed after any of the
Statement.executeUpdate(String) methods are invoked. |
void |
onAfterGetConnection(ConnectionInformation connectionInformation,
SQLException e)
|
void |
onAfterGetResultSet(StatementInformation statementInformation,
long timeElapsedNanos,
SQLException e)
This callback method is executed after the
Statement.getResultSet() method is invoked. |
void |
onAfterPreparedStatementSet(PreparedStatementInformation statementInformation,
int parameterIndex,
Object value,
SQLException e)
This callback method is executed after any of the
PreparedStatement.set* methods are invoked. |
void |
onAfterResultSetClose(ResultSetInformation resultSetInformation,
SQLException e)
This callback method is executed after the
ResultSet.close() method is invoked. |
void |
onAfterResultSetGet(ResultSetInformation resultSetInformation,
int columnIndex,
Object value,
SQLException e)
This callback method is executed after any of the
ResultSet#get*(int) methods are invoked. |
void |
onAfterResultSetGet(ResultSetInformation resultSetInformation,
String columnLabel,
Object value,
SQLException e)
This callback method is executed after any of the
ResultSet#get*(String) methods are invoked. |
void |
onAfterResultSetNext(ResultSetInformation resultSetInformation,
long timeElapsedNanos,
boolean hasNext,
SQLException e)
This callback method is executed after the
ResultSet.next() method is invoked. |
void |
onAfterRollback(ConnectionInformation connectionInformation,
long timeElapsedNanos,
SQLException e)
This callback method is executed after the
Connection.rollback() or the Connection.rollback(Savepoint) method is invoked. |
void |
onAfterStatementClose(StatementInformation statementInformation,
SQLException e)
This callback method is executed after the
Statement.close() method is invoked. |
void |
onBeforeAddBatch(PreparedStatementInformation statementInformation)
This callback method is executed before the
PreparedStatement.addBatch() method is invoked. |
String |
onBeforeAddBatch(StatementInformation statementInformation,
String sql)
This callback method is executed before the
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked. |
void |
onBeforeCommit(ConnectionInformation connectionInformation)
This callback method is executed before the
Connection.commit() method is invoked. |
void |
onBeforeExecute(PreparedStatementInformation statementInformation)
This callback method is executed before any of the
PreparedStatement.execute() methods are invoked. |
String |
onBeforeExecute(StatementInformation statementInformation,
String sql)
This callback method is executed before any of the
Statement.execute(String) methods are invoked. |
void |
onBeforeExecuteBatch(StatementInformation statementInformation)
This callback method is executed before the
Statement.executeBatch() method is invoked. |
void |
onBeforeExecuteQuery(PreparedStatementInformation statementInformation)
This callback method is executed before the
PreparedStatement.executeQuery() method is invoked. |
String |
onBeforeExecuteQuery(StatementInformation statementInformation,
String sql)
This callback method is executed before the
Statement.executeQuery(String) method is invoked. |
void |
onBeforeExecuteUpdate(PreparedStatementInformation statementInformation)
This callback method is executed before the
PreparedStatement.executeUpdate() method is invoked. |
String |
onBeforeExecuteUpdate(StatementInformation statementInformation,
String sql)
This callback method is executed before any of the
Statement.executeUpdate(String) methods are invoked. |
void |
onBeforeGetConnection(ConnectionInformation connectionInformation)
|
void |
onBeforeResultSetNext(ResultSetInformation resultSetInformation)
This callback method is executed before the
ResultSet.next() method is invoked. |
void |
onBeforeRollback(ConnectionInformation connectionInformation)
This callback method is executed before the
Connection.rollback() or the Connection.rollback(Savepoint) method is invoked. |
void |
onConnectionWrapped(ConnectionInformation connectionInformation)
|
public void onBeforeGetConnection(ConnectionInformation connectionInformation)
Connection obtained from a DataSource or a Driver.
The ConnectionInformation holds information about the creator of the connection which is either
,though ConnectionInformation.connection itself is null.
connectionInformation - The meta information about the wrapped Connectionpublic void onAfterGetConnection(ConnectionInformation connectionInformation, SQLException e)
Connection obtained from a DataSource or a Driver.
The ConnectionInformation holds information about the creator of the connection which is either
, though ConnectionInformation.connection itself is null
when SQLException is not null and vise versa.
connectionInformation - The meta information about the wrapped Connectione - The SQLException which may be triggered by the call (null if
there was no exception).@Deprecated public void onConnectionWrapped(ConnectionInformation connectionInformation)
Connection has been created.
The ConnectionInformation holds information about the creator of the connection which is either
connectionInformation - The meta information about the wrapped Connectionpublic void onBeforeAddBatch(PreparedStatementInformation statementInformation)
PreparedStatement.addBatch() method is invoked.statementInformation - The meta information about the Statement being invokedpublic void onAfterAddBatch(PreparedStatementInformation statementInformation, long timeElapsedNanos, SQLException e)
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute calle - The SQLException which may be triggered by the call (null if
there was no exception).public String onBeforeAddBatch(StatementInformation statementInformation, String sql)
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodpublic void onAfterAddBatch(StatementInformation statementInformation, long timeElapsedNanos, String sql, SQLException e)
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute callsql - The SQL string provided to the execute methode - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeExecute(PreparedStatementInformation statementInformation) throws SQLException
PreparedStatement.execute() methods are invoked.statementInformation - The meta information about the Statement being invokedSQLException - SQLExceptionpublic void onAfterExecute(PreparedStatementInformation statementInformation, long timeElapsedNanos, SQLException e)
PreparedStatement.execute() methods are invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute calle - The SQLException which may be triggered by the call (null if
there was no exception).public String onBeforeExecute(StatementInformation statementInformation, String sql) throws SQLException
Statement.execute(String) methods are invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodSQLException - SQLExceptionpublic void onAfterExecute(StatementInformation statementInformation, long timeElapsedNanos, String sql, SQLException e)
Statement.execute(String) methods are invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute callsql - The SQL string provided to the execute methode - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeExecuteBatch(StatementInformation statementInformation) throws SQLException
Statement.executeBatch() method is invoked.statementInformation - The meta information about the Statement being invokedSQLException - SQLExceptionpublic void onAfterExecuteBatch(StatementInformation statementInformation, long timeElapsedNanos, int[] updateCounts, SQLException e)
Statement.executeBatch() method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute callupdateCounts - An array of update counts or null if an exception was throwne - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeExecuteUpdate(PreparedStatementInformation statementInformation) throws SQLException
PreparedStatement.executeUpdate() method is invoked.statementInformation - The meta information about the Statement being invokedSQLException - SQLExceptionpublic void onAfterExecuteUpdate(PreparedStatementInformation statementInformation, long timeElapsedNanos, int rowCount, SQLException e)
PreparedStatement.executeUpdate() method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute callrowCount - Either the row count for SQL Data Manipulation Language (DML) statements or 0 for SQL
statements that return nothing or if an exception was throwne - The SQLException which may be triggered by the call (null if
there was no exception).public String onBeforeExecuteUpdate(StatementInformation statementInformation, String sql) throws SQLException
Statement.executeUpdate(String) methods are invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodSQLException - SQLExceptionpublic void onAfterExecuteUpdate(StatementInformation statementInformation, long timeElapsedNanos, String sql, int rowCount, SQLException e)
Statement.executeUpdate(String) methods are invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute callsql - The SQL string provided to the execute methodrowCount - Either the row count for SQL Data Manipulation Language (DML) statements or 0 for SQL
statements that return nothing or if an exception was throwne - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeExecuteQuery(PreparedStatementInformation statementInformation) throws SQLException
PreparedStatement.executeQuery() method is invoked.statementInformation - The meta information about the Statement being invokedSQLException - SQLExceptionpublic void onAfterExecuteQuery(PreparedStatementInformation statementInformation, long timeElapsedNanos, SQLException e)
PreparedStatement.executeQuery() method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute calle - The SQLException which may be triggered by the call (null if
there was no exception).public String onBeforeExecuteQuery(StatementInformation statementInformation, String sql) throws SQLException
Statement.executeQuery(String) method is invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodSQLException - SQLExceptionpublic void onAfterExecuteQuery(StatementInformation statementInformation, long timeElapsedNanos, String sql, SQLException e)
Statement.executeQuery(String) method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute callsql - The SQL string provided to the execute methode - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterPreparedStatementSet(PreparedStatementInformation statementInformation, int parameterIndex, Object value, SQLException e)
PreparedStatement.set* methods are invoked.statementInformation - The meta information about the Statement being invokedparameterIndex - The first parameter is 1, the second is 2, ...value - the column value; if the value is SQL NULL, the value returned is nulle - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterCallableStatementSet(CallableStatementInformation statementInformation, String parameterName, Object value, SQLException e)
CallableStatement.set* methods are invoked.statementInformation - The meta information about the Statement being invokedparameterName - The name of the parametervalue - the column value; if the value is SQL NULL, the value returned is nulle - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterGetResultSet(StatementInformation statementInformation, long timeElapsedNanos, SQLException e)
Statement.getResultSet() method is invoked.statementInformation - The meta information about the Statement being invokedtimeElapsedNanos - The execution time of the execute calle - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeResultSetNext(ResultSetInformation resultSetInformation)
ResultSet.next() method is invoked.resultSetInformation - The meta information about the ResultSet being invokedpublic void onAfterResultSetNext(ResultSetInformation resultSetInformation, long timeElapsedNanos, boolean hasNext, SQLException e)
ResultSet.next() method is invoked.resultSetInformation - The meta information about the ResultSet being invokedtimeElapsedNanos - The execution time of the execute callhasNext - The return value of ResultSet.next()e - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterResultSetClose(ResultSetInformation resultSetInformation, SQLException e)
ResultSet.close() method is invoked.resultSetInformation - The meta information about the ResultSet being invokede - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterResultSetGet(ResultSetInformation resultSetInformation, String columnLabel, Object value, SQLException e)
ResultSet#get*(String) methods are invoked.resultSetInformation - The meta information about the ResultSet being invokedcolumnLabel - The label for the column specified with the SQL AS clause. If the SQL AS clause was
not specified, then the label is the name of the columnvalue - The column value; if the value is SQL NULL, the value returned is nulle - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterResultSetGet(ResultSetInformation resultSetInformation, int columnIndex, Object value, SQLException e)
ResultSet#get*(int) methods are invoked.resultSetInformation - The meta information about the ResultSet being invokedcolumnIndex - the first column is 1, the second is 2, ...value - the column value; if the value is SQL NULL, the value returned is nulle - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeCommit(ConnectionInformation connectionInformation)
Connection.commit() method is invoked.connectionInformation - The meta information about the Connection being invokedpublic void onAfterCommit(ConnectionInformation connectionInformation, long timeElapsedNanos, SQLException e)
Connection.commit() method is invoked.connectionInformation - The meta information about the Connection being invokedtimeElapsedNanos - The execution time of the execute calle - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterConnectionClose(ConnectionInformation connectionInformation, SQLException e)
Connection.close() method is invoked.connectionInformation - The meta information about the Connection being invokede - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeRollback(ConnectionInformation connectionInformation)
Connection.rollback() or the Connection.rollback(Savepoint) method is invoked.connectionInformation - The meta information about the Connection being invokedpublic void onAfterRollback(ConnectionInformation connectionInformation, long timeElapsedNanos, SQLException e)
Connection.rollback() or the Connection.rollback(Savepoint) method is invoked.connectionInformation - The meta information about the Connection being invokedtimeElapsedNanos - The execution time of the execute calle - The SQLException which may be triggered by the call (null if
there was no exception).public void onAfterStatementClose(StatementInformation statementInformation, SQLException e)
Statement.close() method is invoked.statementInformation - The meta information about the Statement being invokede - The SQLException which may be triggered by the call (null if
there was no exception).Copyright © 2019. All rights reserved.