public abstract class JdbcEventListener
extends java.lang.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.
The second way is to implement a P6Factory
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.p6spy.engine.common.ConnectionInformation) method throws an exception
your application won't be able to create any Connection.
| Constructor and Description |
|---|
JdbcEventListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
onAfterAddBatch(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
java.sql.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,
java.lang.String sql,
java.sql.SQLException e)
This callback method is executed after the
Statement.addBatch(String) or
Statement.addBatch(String) method is invoked. |
void |
onAfterCallableStatementSet(CallableStatementInformation statementInformation,
java.lang.String parameterName,
java.lang.Object value,
java.sql.SQLException e)
This callback method is executed after any of the
CallableStatement.set* methods are invoked. |
void |
onAfterCommit(ConnectionInformation connectionInformation,
long timeElapsedNanos,
java.sql.SQLException e)
This callback method is executed after the
Connection.commit() method is invoked. |
void |
onAfterConnectionClose(ConnectionInformation connectionInformation,
java.sql.SQLException e)
This callback method is executed after the
Connection.close() method is invoked. |
void |
onAfterExecute(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
java.sql.SQLException e)
This callback method is executed after any the
PreparedStatement.execute() methods are invoked. |
void |
onAfterExecute(StatementInformation statementInformation,
long timeElapsedNanos,
java.lang.String sql,
java.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,
java.sql.SQLException e)
This callback method is executed after the
Statement.executeBatch() method is invoked. |
void |
onAfterExecuteQuery(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
java.sql.SQLException e)
This callback method is executed after the
PreparedStatement.executeQuery() method is invoked. |
void |
onAfterExecuteQuery(StatementInformation statementInformation,
long timeElapsedNanos,
java.lang.String sql,
java.sql.SQLException e)
This callback method is executed after the
Statement.executeQuery(String) method is invoked. |
void |
onAfterExecuteUpdate(PreparedStatementInformation statementInformation,
long timeElapsedNanos,
int rowCount,
java.sql.SQLException e)
This callback method is executed after the
PreparedStatement.executeUpdate() method is invoked. |
void |
onAfterExecuteUpdate(StatementInformation statementInformation,
long timeElapsedNanos,
java.lang.String sql,
int rowCount,
java.sql.SQLException e)
This callback method is executed after any of the
Statement.executeUpdate(String) methods are invoked. |
void |
onAfterGetConnection(ConnectionInformation connectionInformation,
java.sql.SQLException e)
This callback method is executed after a
Connection obtained from a DataSource or a Driver. |
void |
onAfterGetResultSet(StatementInformation statementInformation,
long timeElapsedNanos,
java.sql.SQLException e)
This callback method is executed after the
Statement.getResultSet() method is invoked. |
void |
onAfterPreparedStatementSet(PreparedStatementInformation statementInformation,
int parameterIndex,
java.lang.Object value,
java.sql.SQLException e)
This callback method is executed after any of the
PreparedStatement.set* methods are invoked. |
void |
onAfterResultSetClose(ResultSetInformation resultSetInformation,
java.sql.SQLException e)
This callback method is executed after the
ResultSet.close() method is invoked. |
void |
onAfterResultSetGet(ResultSetInformation resultSetInformation,
int columnIndex,
java.lang.Object value,
java.sql.SQLException e)
This callback method is executed after any of the
ResultSet#get*(int) methods are invoked. |
void |
onAfterResultSetGet(ResultSetInformation resultSetInformation,
java.lang.String columnLabel,
java.lang.Object value,
java.sql.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,
java.sql.SQLException e)
This callback method is executed after the
ResultSet.next() method is invoked. |
void |
onAfterRollback(ConnectionInformation connectionInformation,
long timeElapsedNanos,
java.sql.SQLException e)
This callback method is executed after the
Connection.rollback() or the Connection.rollback(Savepoint) method is invoked. |
void |
onAfterSetAutoCommit(ConnectionInformation connectionInformation,
boolean newAutoCommit,
boolean oldAutoCommit,
java.sql.SQLException e)
This callback method is executed after
Connection.setAutoCommit(boolean) was called. |
void |
onAfterStatementClose(StatementInformation statementInformation,
java.sql.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. |
void |
onBeforeAddBatch(StatementInformation statementInformation,
java.lang.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. |
void |
onBeforeExecute(StatementInformation statementInformation,
java.lang.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. |
void |
onBeforeExecuteQuery(StatementInformation statementInformation,
java.lang.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. |
void |
onBeforeExecuteUpdate(StatementInformation statementInformation,
java.lang.String sql)
This callback method is executed before any of the
Statement.executeUpdate(String) methods are invoked. |
void |
onBeforeGetConnection(ConnectionInformation connectionInformation)
This callback method is executed before a
Connection obtained from a DataSource or a Driver. |
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 |
onBeforeSetAutoCommit(ConnectionInformation connectionInformation,
boolean newAutoCommit,
boolean currentAutoCommit)
This callback method is executed before calling
Connection.setAutoCommit(boolean) |
void |
onConnectionWrapped(ConnectionInformation connectionInformation)
Deprecated.
|
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
ConnectionInformation.dataSource, ConnectionInformation.driver or
ConnectionInformation.pooledConnection, though ConnectionInformation.connection itself is null.
connectionInformation - The meta information about the wrapped Connectionpublic void onAfterGetConnection(ConnectionInformation connectionInformation, java.sql.SQLException e)
Connection obtained from a DataSource or a Driver.
The ConnectionInformation holds information about the creator of the connection which is either
ConnectionInformation.dataSource, ConnectionInformation.driver or
ConnectionInformation.pooledConnection, 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)
onAfterGetConnection(ConnectionInformation, SQLException)Connection has been created.
The ConnectionInformation holds information about the creator of the connection which is either
ConnectionInformation.dataSource, ConnectionInformation.driver or
ConnectionInformation.pooledConnection.
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, java.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 calle - The SQLException which may be triggered by the call (null if
there was no exception).public void onBeforeAddBatch(StatementInformation statementInformation, java.lang.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, java.lang.String sql, java.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)
PreparedStatement.execute() methods are invoked.statementInformation - The meta information about the Statement being invokedpublic void onAfterExecute(PreparedStatementInformation statementInformation, long timeElapsedNanos, java.sql.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 void onBeforeExecute(StatementInformation statementInformation, java.lang.String sql)
Statement.execute(String) methods are invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodpublic void onAfterExecute(StatementInformation statementInformation, long timeElapsedNanos, java.lang.String sql, java.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)
Statement.executeBatch() method is invoked.statementInformation - The meta information about the Statement being invokedpublic void onAfterExecuteBatch(StatementInformation statementInformation, long timeElapsedNanos, int[] updateCounts, java.sql.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)
PreparedStatement.executeUpdate() method is invoked.statementInformation - The meta information about the Statement being invokedpublic void onAfterExecuteUpdate(PreparedStatementInformation statementInformation, long timeElapsedNanos, int rowCount, java.sql.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 void onBeforeExecuteUpdate(StatementInformation statementInformation, java.lang.String sql)
Statement.executeUpdate(String) methods are invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodpublic void onAfterExecuteUpdate(StatementInformation statementInformation, long timeElapsedNanos, java.lang.String sql, int rowCount, java.sql.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)
PreparedStatement.executeQuery() method is invoked.statementInformation - The meta information about the Statement being invokedpublic void onAfterExecuteQuery(PreparedStatementInformation statementInformation, long timeElapsedNanos, java.sql.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 void onBeforeExecuteQuery(StatementInformation statementInformation, java.lang.String sql)
Statement.executeQuery(String) method is invoked.statementInformation - The meta information about the Statement being invokedsql - The SQL string provided to the execute methodpublic void onAfterExecuteQuery(StatementInformation statementInformation, long timeElapsedNanos, java.lang.String sql, java.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, java.lang.Object value, java.sql.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, java.lang.String parameterName, java.lang.Object value, java.sql.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, java.sql.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, java.sql.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, java.sql.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, java.lang.String columnLabel, java.lang.Object value, java.sql.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, java.lang.Object value, java.sql.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, java.sql.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, java.sql.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, java.sql.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, java.sql.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).public void onBeforeSetAutoCommit(ConnectionInformation connectionInformation, boolean newAutoCommit, boolean currentAutoCommit)
Connection.setAutoCommit(boolean)connectionInformation - The meta information about the Connection being invokednewAutoCommit - The new auto commit flag about to be setcurrentAutoCommit - The current auto commit flag about to be changedpublic void onAfterSetAutoCommit(ConnectionInformation connectionInformation, boolean newAutoCommit, boolean oldAutoCommit, java.sql.SQLException e)
Connection.setAutoCommit(boolean) was called.connectionInformation - The meta information about the Connection being invokednewAutoCommit - The new auto commit flag that was set if no exception was thrownoldAutoCommit - The old auto commit flage - The SQLException which may be triggered by the call, (null if
there was no exception).