public class CompositeConnectionListener extends org.logicalcobwebs.proxool.util.AbstractListenerContainer implements ConnectionListenerIF
ConnectionListenerIF that keeps a list of ConnectionListenerIFs
and notifies them in a thread safe manner.
It also implements ListenerContainerIF
which provides methods for
adding and
removing listeners.FATAL_SQL_EXCEPTION_DETECTED, HOUSE_KEEPER_TEST_FAIL, MANUAL_EXPIRY, MAXIMUM_ACTIVE_TIME_EXPIRED, MAXIMUM_CONNECTION_LIFETIME_EXCEEDED, RESET_FAIL, SHUTDOWN, VALIDATION_FAIL| Constructor and Description |
|---|
CompositeConnectionListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
onBirth(java.sql.Connection connection)
Happens everytime we create a new connection.
|
void |
onDeath(java.sql.Connection connection,
int reasonCode)
Happens just before we expire a connection.
|
void |
onExecute(java.lang.String command,
long elapsedTime)
Happens after every successful execute.
|
void |
onFail(java.lang.String command,
java.lang.Exception exception)
Happens everytime an exception was thrown during an execute method
Note that the command
is not fully implemented at this stage.
|
public void onBirth(java.sql.Connection connection)
throws java.sql.SQLException
ConnectionListenerIFonBirth in interface ConnectionListenerIFconnection - the connection that has just been createdjava.sql.SQLException - if anything goes wrong (which will then be logged but ignored)ConnectionListenerIF.onBirth(Connection)public void onDeath(java.sql.Connection connection,
int reasonCode)
throws java.sql.SQLException
ConnectionListenerIFonDeath in interface ConnectionListenerIFconnection - the connection that is about to expirereasonCode - ConnectionListenerIF.MAXIMUM_ACTIVE_TIME_EXPIRED,
ConnectionListenerIF.HOUSE_KEEPER_TEST_FAIL,
ConnectionListenerIF.FATAL_SQL_EXCEPTION_DETECTED,
ConnectionListenerIF.MANUAL_EXPIRY,
ConnectionListenerIF.MAXIMUM_CONNECTION_LIFETIME_EXCEEDED,
ConnectionListenerIF.RESET_FAIL,
ConnectionListenerIF.SHUTDOWN, or
ConnectionListenerIF.VALIDATION_FAILjava.sql.SQLException - if anything goes wrong (which will then be logged but ignored)ConnectionListenerIF.onDeath(java.sql.Connection, int)public void onExecute(java.lang.String command,
long elapsedTime)
ConnectionListenerIFonExecute in interface ConnectionListenerIFcommand - what command was being executedelapsedTime - how long the call took (in milliseconds)ConnectionListenerIF.onExecute(String, long)public void onFail(java.lang.String command,
java.lang.Exception exception)
ConnectionListenerIFonFail in interface ConnectionListenerIFcommand - what command was being executedexception - what exception was thrownConnectionListenerIF.onFail(String, Exception)