public class CompositeConnectionListener extends 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| 构造器和说明 |
|---|
CompositeConnectionListener() |
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
addListener, getListeners, isEmpty, removeListenerpublic void onBirth(Connection connection) throws SQLException
ConnectionListenerIFonBirth 在接口中 ConnectionListenerIFconnection - the connection that has just been createdSQLException - if anything goes wrong (which will then be logged but ignored)ConnectionListenerIF.onBirth(Connection)public void onDeath(Connection connection, int reasonCode) throws SQLException
ConnectionListenerIFonDeath 在接口中 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_FAILSQLException - if anything goes wrong (which will then be logged but ignored)ConnectionListenerIF.onDeath(java.sql.Connection, int)public void onExecute(String command, long elapsedTime)
ConnectionListenerIFonExecute 在接口中 ConnectionListenerIFcommand - what command was being executedelapsedTime - how long the call took (in milliseconds)ConnectionListenerIF.onExecute(String, long)public void onFail(String command, Exception exception)
ConnectionListenerIFonFail 在接口中 ConnectionListenerIFcommand - what command was being executedexception - what exception was thrownConnectionListenerIF.onFail(String, Exception)Copyright © 2024. All rights reserved.