org.logicalcobwebs.proxool
接口 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)

字段摘要
static int FATAL_SQL_EXCEPTION_DETECTED
          We are killing a connection because a FATAL_SQL_EXCEPTION has been detected.
static int HOUSE_KEEPER_TEST_FAIL
          We are killing a connection because the routine house keeper test failed
static int MANUAL_EXPIRY
          We are killing a connection because it's manually been expired (by something external to Proxool)
static int MAXIMUM_ACTIVE_TIME_EXPIRED
          We are killing a connection because the MAXIMUM_ACTIVE_TIME has been exceeded.
static int MAXIMUM_CONNECTION_LIFETIME_EXCEEDED
          We are killing a connection because it's MAXIMUM_CONNECTION_LIFETIME has been exceeded.
static 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.
static int SHUTDOWN
          We are killing a connection because Proxool is shutting down
static int VALIDATION_FAIL
          We are killing a connection because it has not been validated.
 
方法摘要
 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.
 

字段详细信息

MAXIMUM_ACTIVE_TIME_EXPIRED

static final int MAXIMUM_ACTIVE_TIME_EXPIRED
We are killing a connection because the MAXIMUM_ACTIVE_TIME has been exceeded.

另请参见:
onDeath(java.sql.Connection, int), 常量字段值

MANUAL_EXPIRY

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), 常量字段值

VALIDATION_FAIL

static final int VALIDATION_FAIL
We are killing a connection because it has not been validated.

另请参见:
onDeath(java.sql.Connection, int), 常量字段值

SHUTDOWN

static final int SHUTDOWN
We are killing a connection because Proxool is shutting down

另请参见:
onDeath(java.sql.Connection, int), 常量字段值

RESET_FAIL

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), 常量字段值

HOUSE_KEEPER_TEST_FAIL

static final int HOUSE_KEEPER_TEST_FAIL
We are killing a connection because the routine house keeper test failed

另请参见:
onDeath(java.sql.Connection, int), 常量字段值

MAXIMUM_CONNECTION_LIFETIME_EXCEEDED

static final int MAXIMUM_CONNECTION_LIFETIME_EXCEEDED
We are killing a connection because it's MAXIMUM_CONNECTION_LIFETIME has been exceeded.

另请参见:
onDeath(java.sql.Connection, int), 常量字段值

FATAL_SQL_EXCEPTION_DETECTED

static final int FATAL_SQL_EXCEPTION_DETECTED
We are killing a connection because a FATAL_SQL_EXCEPTION has been detected.

另请参见:
onDeath(java.sql.Connection, int), 常量字段值
方法详细信息

onBirth

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
抛出:
SQLException - if anything goes wrong (which will then be logged but ignored)

onDeath

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.

参数:
connection - the connection that is about to expire
reasonCode - MAXIMUM_ACTIVE_TIME_EXPIRED, HOUSE_KEEPER_TEST_FAIL, FATAL_SQL_EXCEPTION_DETECTED, MANUAL_EXPIRY, MAXIMUM_CONNECTION_LIFETIME_EXCEEDED, RESET_FAIL, SHUTDOWN, or VALIDATION_FAIL
抛出:
SQLException - if anything goes wrong (which will then be logged but ignored)

onExecute

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 executed
elapsedTime - how long the call took (in milliseconds)

onFail

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 executed
exception - what exception was thrown


Copyright © 2014. All rights reserved.