public abstract class AbstractConnectionHook extends Object implements ConnectionHook
| Constructor and Description |
|---|
AbstractConnectionHook() |
| Modifier and Type | Method and Description |
|---|---|
void |
onAcquire(ConnectionHandle connection)
Called upon getting a new connection from the JDBC driver (and prior to
inserting into the pool).
|
boolean |
onAcquireFail(Throwable t,
AcquireFailConfig acquireConfig)
Called on attempting (and failing) to acquire a connection.
|
void |
onAfterStatementExecute(ConnectionHandle conn,
StatementHandle statement,
String sql,
Map<Object,Object> params)
Called right after a statement has executed.
|
void |
onBeforeStatementExecute(ConnectionHandle conn,
StatementHandle statement,
String sql,
Map<Object,Object> params)
Called before a statement is about to execute.
|
void |
onCheckIn(ConnectionHandle connection)
Called when the connection is about to be returned to the pool.
|
void |
onCheckOut(ConnectionHandle connection)
Called when the connection is extracted from the pool and about to be
given to the application.
|
boolean |
onConnectionException(ConnectionHandle connection,
String state,
Throwable t)
Called whenever an exception on a connection occurs.
|
void |
onDestroy(ConnectionHandle connection)
Called when the connection is about to be completely removed from the
pool.
|
ConnectionState |
onMarkPossiblyBroken(ConnectionHandle connection,
String state,
SQLException e)
Called to give you a chance to override the logic on whether a connection can be considered
broken or not.
|
void |
onQueryExecuteTimeLimitExceeded(ConnectionHandle handle,
Statement statement,
String sql,
Map<Object,Object> logParams)
Deprecated.
|
void |
onQueryExecuteTimeLimitExceeded(ConnectionHandle handle,
Statement statement,
String sql,
Map<Object,Object> logParams,
long timeElapsedInNs)
Called when a query execute time limit has been set and an executing query took longer
to than the limit to return control to the application.
|
void |
onQueryExecuteTimeLimitExceeded(String sql,
Map<Object,Object> logParams)
Deprecated.
|
public void onAcquire(ConnectionHandle connection)
ConnectionHookonAcquire in interface ConnectionHookconnection - Handle to the new connectionpublic void onCheckIn(ConnectionHandle connection)
ConnectionHookonCheckIn in interface ConnectionHookconnection - being returned to pool.public void onCheckOut(ConnectionHandle connection)
ConnectionHookonCheckOut in interface ConnectionHookconnection - about to given to the app.public void onDestroy(ConnectionHandle connection)
ConnectionHookonDestroy in interface ConnectionHookpublic boolean onAcquireFail(Throwable t, AcquireFailConfig acquireConfig)
ConnectionHookonAcquireFail in interface ConnectionHookt - Exception that occurred.acquireConfig - handle containing retry delay, retry attempts etc.public void onQueryExecuteTimeLimitExceeded(ConnectionHandle handle, Statement statement, String sql, Map<Object,Object> logParams, long timeElapsedInNs)
ConnectionHookonQueryExecuteTimeLimitExceeded in interface ConnectionHookhandle - handle to the connectionstatement - statement handle.sql - SQL statement that was used.logParams - Parameters used in this statement.timeElapsedInNs - actual time the query took (in nanoseconds)@Deprecated public void onQueryExecuteTimeLimitExceeded(ConnectionHandle handle, Statement statement, String sql, Map<Object,Object> logParams)
ConnectionHookonQueryExecuteTimeLimitExceeded in interface ConnectionHookhandle - statement - sql - logParams - @Deprecated public void onQueryExecuteTimeLimitExceeded(String sql, Map<Object,Object> logParams)
ConnectionHookonQueryExecuteTimeLimitExceeded in interface ConnectionHooksql - SQL statement that was used.logParams - Parameters used in this statement.public boolean onConnectionException(ConnectionHandle connection, String state, Throwable t)
ConnectionHookSQLSTATE Value
Value Meaning
08001 The application requester is unable to establish the connection.
08002 The connection already exists.
08003 The connection does not exist.
08004 The application server rejected establishment of the connection.
08007 Transaction resolution unknown.
08502 The CONNECT statement issued by an application process running with a SYNCPOINT of TWOPHASE has failed, because no transaction manager is available.
08504 An error was encountered while processing the specified path rename configuration file.
SQL Failure codes 08001, 08007 & 57P01 indicate that the database is broken/died (and thus all remaining connections are killed off).
Anything else will be taken as the connection (not the db) being broken.
Note: You may use pool.isConnectionHandleAlive(connection) to verify if the connection is in a usable state again. Note 2: As in all interceptor hooks, this method may be called concurrently so any implementation must be thread-safe.
onConnectionException in interface ConnectionHookconnection - The handle that triggered this errorstate - the SQLState error code.t - Exception that caused this failure.public void onBeforeStatementExecute(ConnectionHandle conn, StatementHandle statement, String sql, Map<Object,Object> params)
ConnectionHookonBeforeStatementExecute in interface ConnectionHookconn - Connection handlestatement - Handle to the statementsql - SQL statement about to be executed.params - parameters currently bound to the statementpublic void onAfterStatementExecute(ConnectionHandle conn, StatementHandle statement, String sql, Map<Object,Object> params)
ConnectionHookonAfterStatementExecute in interface ConnectionHookconn - Connection handlestatement - Handle to the statementsql - SQL statement about to be executed.params - parameters currently bound to the statementpublic ConnectionState onMarkPossiblyBroken(ConnectionHandle connection, String state, SQLException e)
ConnectionHookonMarkPossiblyBroken in interface ConnectionHookconnection - The handle that triggered this errorstate - the SQLState error code.e - Exception that caused us to call this hook.Copyright © 2009-2013 JolBox. All Rights Reserved.