org.logicalcobwebs.proxool
Interface ConnectionListenerIF
- CompositeConnectionListener
public interface ConnectionListenerIF
You can listen to the lifecycle of a connection. Sometimes, you may
want to perform a task when the connection is born or dies. Actually,
the reason why we originally did this is now obsolete. But the code
remains here just in case. You need to
register
your implementation with ProxoolFacade.
String alias = "myPool";
ConnectionListenerIF myConnectionListener = new MyConnectionListener();
ProxoolFacade.addConnectionListener
(alias, myConnectionListener);
$Revision: 1.9 $, $Date: 2007/01/25 23:38:24 $- billhorsman
- $Author: billhorsman $ (current maintainer)
void | onBirth(Connection connection) - Happens everytime we create a new connection.
|
void | onDeath(Connection connection, int reasonCode) - Happens just before we expire a connection.
|
void | onExecute(String command, long elapsedTime) - Happens after every successful execute.
|
void | onFail(String command, Exception exception) - Happens everytime an exception was thrown during an execute method
Note that the command
is not fully implemented at this stage.
|
FATAL_SQL_EXCEPTION_DETECTED
public static final int FATAL_SQL_EXCEPTION_DETECTED
onDeath(java.sql.Connection, int)
HOUSE_KEEPER_TEST_FAIL
public static final int HOUSE_KEEPER_TEST_FAIL
We are killing a connection because the routine house keeper test failed
onDeath(java.sql.Connection, int)
MANUAL_EXPIRY
public static final int MANUAL_EXPIRY
We are killing a connection because it's manually been expired (by something external to
Proxool)
onDeath(java.sql.Connection, int)
MAXIMUM_ACTIVE_TIME_EXPIRED
public static final int MAXIMUM_ACTIVE_TIME_EXPIRED
onDeath(java.sql.Connection, int)
MAXIMUM_CONNECTION_LIFETIME_EXCEEDED
public static final int MAXIMUM_CONNECTION_LIFETIME_EXCEEDED
onDeath(java.sql.Connection, int)
RESET_FAIL
public static final int RESET_FAIL
We are killing a connection because it couldn't be reset
after it was returned to the pool and we don't want to give it out again in an unknown state.
onDeath(java.sql.Connection, int)
SHUTDOWN
public static final int SHUTDOWN
We are killing a connection because Proxool is shutting down
onDeath(java.sql.Connection, int)
VALIDATION_FAIL
public static final int VALIDATION_FAIL
We are killing a connection because it has not been
validated
.
onDeath(java.sql.Connection, int)
onBirth
public void onBirth(Connection connection)
throws SQLException
Happens everytime we create a new connection. You can use this
to allocate resources to a connection that might be useful during
the lifetime of the connection.
connection
- the connection that has just been created
onDeath
public void onDeath(Connection connection,
int reasonCode)
throws SQLException
Happens just before we expire a connection. You can use this to
reclaim resources from a connection.
onExecute
public void onExecute(String command,
long elapsedTime)
Happens after every successful execute. Note that the command
is not fully implemented at this stage. At some point it might represent
the SQL that is sent to the database (or the procedure call that was used).
command
- what command was being executedelapsedTime
- how long the call took (in milliseconds)
onFail
public void onFail(String command,
Exception exception)
Happens everytime an exception was thrown during an execute method
Note that the command
is not fully implemented at this stage. At some point it might represent
the SQL that is sent to the database (or the procedure call that was used).
command
- what command was being executedexception
- what exception was thrown