Package org.logicalcobwebs.proxool
Class CompositeConnectionListener
- java.lang.Object
-
- org.logicalcobwebs.proxool.util.AbstractListenerContainer
-
- org.logicalcobwebs.proxool.CompositeConnectionListener
-
- All Implemented Interfaces:
ConnectionListenerIF
,ListenerContainerIF
public class CompositeConnectionListener extends AbstractListenerContainer implements ConnectionListenerIF
AConnectionListenerIF
that keeps a list ofConnectionListenerIF
s and notifies them in a thread safe manner. It also implementsListenerContainerIF
which provides methods foradding
andremoving
listeners.- Since:
- Proxool 0.7
- Version:
- $Revision: 1.8 $, $Date: 2007/01/25 23:38:24 $
- Author:
- Christian Nedregaard (christian_nedregaard@email.com), $Author: billhorsman $ (current maintainer)
-
-
Field Summary
-
Fields inherited from interface org.logicalcobwebs.proxool.ConnectionListenerIF
FATAL_SQL_EXCEPTION_DETECTED, HOUSE_KEEPER_TEST_FAIL, MANUAL_EXPIRY, MAXIMUM_ACTIVE_TIME_EXPIRED, MAXIMUM_CONNECTION_LIFETIME_EXCEEDED, RESET_FAIL, SHUTDOWN, VALIDATION_FAIL
-
-
Constructor Summary
Constructors Constructor Description CompositeConnectionListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class org.logicalcobwebs.proxool.util.AbstractListenerContainer
addListener, getListeners, isEmpty, removeListener
-
-
-
-
Method Detail
-
onBirth
public void onBirth(java.sql.Connection connection) throws java.sql.SQLException
Description copied from interface:ConnectionListenerIF
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.- Specified by:
onBirth
in interfaceConnectionListenerIF
- Parameters:
connection
- the connection that has just been created- Throws:
java.sql.SQLException
- if anything goes wrong (which will then be logged but ignored)- See Also:
ConnectionListenerIF.onBirth(Connection)
-
onDeath
public void onDeath(java.sql.Connection connection, int reasonCode) throws java.sql.SQLException
Description copied from interface:ConnectionListenerIF
Happens just before we expire a connection. You can use this to reclaim resources from a connection.- Specified by:
onDeath
in interfaceConnectionListenerIF
- Parameters:
connection
- 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
, orConnectionListenerIF.VALIDATION_FAIL
- Throws:
java.sql.SQLException
- if anything goes wrong (which will then be logged but ignored)- See Also:
ConnectionListenerIF.onDeath(java.sql.Connection, int)
-
onExecute
public void onExecute(java.lang.String command, long elapsedTime)
Description copied from interface:ConnectionListenerIF
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).- Specified by:
onExecute
in interfaceConnectionListenerIF
- Parameters:
command
- what command was being executedelapsedTime
- how long the call took (in milliseconds)- See Also:
ConnectionListenerIF.onExecute(String, long)
-
onFail
public void onFail(java.lang.String command, java.lang.Exception exception)
Description copied from interface:ConnectionListenerIF
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).- Specified by:
onFail
in interfaceConnectionListenerIF
- Parameters:
command
- what command was being executedexception
- what exception was thrown- See Also:
ConnectionListenerIF.onFail(String, Exception)
-
-