org.logicalcobwebs.proxool
Class CompositeConnectionListener

java.lang.Object
  extended by org.logicalcobwebs.proxool.util.AbstractListenerContainer
      extended by org.logicalcobwebs.proxool.CompositeConnectionListener
All Implemented Interfaces:
ConnectionListenerIF, org.logicalcobwebs.proxool.util.ListenerContainerIF

public class CompositeConnectionListener
extends org.logicalcobwebs.proxool.util.AbstractListenerContainer
implements ConnectionListenerIF

A 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.

Since:
Proxool 0.7
Version:
$Revision: 1.5 $, $Date: 2004/03/16 08:48:32 $
Author:
Christian Nedregaard (christian_nedregaard@email.com), $Author: brenuart $ (current maintainer)

Constructor Summary
CompositeConnectionListener()
           
 
Method Summary
 void onBirth(java.sql.Connection connection)
          Happens everytime we create a new connection.
 void onDeath(java.sql.Connection connection)
          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, isEmpty, removeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompositeConnectionListener

public CompositeConnectionListener()
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 interface ConnectionListenerIF
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)
             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 interface ConnectionListenerIF
Parameters:
connection - the connection that is about to expire
Throws:
java.sql.SQLException - if anything goes wrong (which will then be logged but ignored)
See Also:
ConnectionListenerIF.onDeath(Connection)

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 interface ConnectionListenerIF
Parameters:
command - what command was being executed
elapsedTime - 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 interface ConnectionListenerIF
Parameters:
command - what command was being executed
exception - what exception was thrown
See Also:
ConnectionListenerIF.onFail(String, Exception)