Class SafeDelegatingSqlConnectionInterceptor
java.lang.Object
org.ofbiz.core.entity.jdbc.interceptors.connection.SafeDelegatingSqlConnectionInterceptor
- All Implemented Interfaces:
SQLConnectionInterceptor,SQLInterceptor
public class SafeDelegatingSqlConnectionInterceptor
extends Object
implements SQLConnectionInterceptor
Wraps a
SQLConnectionInterceptor such that the callbacks are guaranteed not to throw
runtime exceptions or linkage errors.- Since:
- v1.0.67 / v1.1.7
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterSuccessfulExecution(String sqlString, List<String> parameterValues, Statement statement, ResultSet resultSet, int rowsUpdated) This is called after a successful (ie noSQLExceptiongenerated) JDBC query is run.voidbeforeExecution(String sqlString, List<String> parameterValues, Statement statement) This is called before an JDBC query is run.voidonConnectionReplaced(Connection connection, ConnectionPoolState connectionPoolState) Called when a connection is returned to the underlying poolvoidonConnectionTaken(Connection connection, ConnectionPoolState connectionPoolState) Called when a connection is taken from the underlying poolvoidonException(String sqlString, List<String> parameterValues, Statement statement, SQLException sqlException) This is called if anSQLExceptionis thrown during the JDBC queryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ofbiz.core.entity.jdbc.interceptors.SQLInterceptor
afterSuccessfulExecution, beforeExecution, onException
-
Constructor Details
-
SafeDelegatingSqlConnectionInterceptor
-
-
Method Details
-
onConnectionTaken
Description copied from interface:SQLConnectionInterceptorCalled when a connection is taken from the underlying pool- Specified by:
onConnectionTakenin interfaceSQLConnectionInterceptor- Parameters:
connection- the connection that has been borrowedconnectionPoolState- info about the connection pool in at the time the connection was taken
-
onConnectionReplaced
Description copied from interface:SQLConnectionInterceptorCalled when a connection is returned to the underlying pool- Specified by:
onConnectionReplacedin interfaceSQLConnectionInterceptor- Parameters:
connection- the connection that has been returnedconnectionPoolState- info about the connection pool in at the time the connection was taken
-
beforeExecution
Description copied from interface:SQLInterceptorThis is called before an JDBC query is run.- Specified by:
beforeExecutionin interfaceSQLInterceptor- Parameters:
sqlString- thw SQL string in playparameterValues- this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parametersstatement- the JDBCStatementin play
-
afterSuccessfulExecution
public void afterSuccessfulExecution(String sqlString, List<String> parameterValues, Statement statement, ResultSet resultSet, int rowsUpdated) Description copied from interface:SQLInterceptorThis is called after a successful (ie noSQLExceptiongenerated) JDBC query is run.If this method runs then by design the
SQLInterceptor.onException(String, java.util.List, java.sql.Statement, java.sql.SQLException)will NOT run.- Specified by:
afterSuccessfulExecutionin interfaceSQLInterceptor- Parameters:
sqlString- the SQL string in playparameterValues- this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parametersstatement- the JDBCStatementin playresultSet- a JDBCResultSet. In the case of an update, this will be NULL.rowsUpdated- the number of rows updated. In the case of a SELECT, this will be -1
-
onException
public void onException(String sqlString, List<String> parameterValues, Statement statement, SQLException sqlException) Description copied from interface:SQLInterceptorThis is called if anSQLExceptionis thrown during the JDBC queryIf this method runs then by design the
SQLInterceptor.afterSuccessfulExecution(String, java.util.List, java.sql.Statement, java.sql.ResultSet, int)will have NOT run.- Specified by:
onExceptionin interfaceSQLInterceptor- Parameters:
sqlString- thw SQL string in playparameterValues- this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parametersstatement- the JDBCStatementin playsqlException- the exception that occurred
-