Interface ConnectionListenerIF

  • All Known Implementing Classes:
    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);
     
    Version:
    $Revision: 1.9 $, $Date: 2007/01/25 23:38:24 $
    Author:
    billhorsman, $Author: billhorsman $ (current maintainer)
    • Method Summary

      All Methods Instance Methods Abstract 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.
    • Method Detail

      • onBirth

        void onBirth​(java.sql.Connection connection)
              throws java.sql.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.
        Parameters:
        connection - the connection that has just been created
        Throws:
        java.sql.SQLException - if anything goes wrong (which will then be logged but ignored)
      • onExecute

        void onExecute​(java.lang.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).
        Parameters:
        command - what command was being executed
        elapsedTime - how long the call took (in milliseconds)
      • onFail

        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. At some point it might represent the SQL that is sent to the database (or the procedure call that was used).
        Parameters:
        command - what command was being executed
        exception - what exception was thrown