*/
private void subtestPooledRemoveListenerOnClose(final PooledConnection pc) throws SQLException
{
final int[] count1 = new int[1];
pc.addConnectionEventListener(new ConnectionEventListener() {
/**
* Mimic a pool handler that removes the listener during
* a logical close.
*/
public void connectionClosed(ConnectionEvent event) {
PooledConnection pce = (PooledConnection) event.getSource();
assertSame(pc, pce);
count1[0]++;
pce.removeConnectionEventListener(this);
}
public void connectionErrorOccurred(ConnectionEvent event) {
}
});
// and have another listener to ensure removing one leaves
// the other working and intact.
final int[] count2 = new int[1];
pc.addConnectionEventListener(new ConnectionEventListener() {
/**
* Mimic a pool handler that closes the PooledConnection
* (say it no longer needs it, pool size being reduced)
*/