}
private void registerPoolEventListener(XAPool pool) throws Exception {
Iterator<?> iterator = pool.getXAResourceHolders().iterator();
while (iterator.hasNext()) {
JdbcPooledConnection jdbcPooledConnection = (JdbcPooledConnection) iterator.next();
jdbcPooledConnection.addStateChangeEventListener(new StateChangeListener() {
public void stateChanged(XAStatefulHolder source, int oldState, int newState) {
if (newState == AbstractXAResourceHolder.STATE_IN_POOL)
EventRecorder.getEventRecorder(this).addEvent(new ConnectionQueuedEvent(this, (JdbcPooledConnection) source));
if (newState == AbstractXAResourceHolder.STATE_ACCESSIBLE)
EventRecorder.getEventRecorder(this).addEvent(new ConnectionDequeuedEvent(this, (JdbcPooledConnection) source));