in geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/AbstractSinglePoolConnectionInterceptor.java [146:187]
protected boolean internalReturn(ConnectionInfo connectionInfo, ConnectionReturnAction connectionReturnAction) {
ManagedConnectionInfo mci = connectionInfo.getManagedConnectionInfo();
ManagedConnection mc = mci.getManagedConnection();
try {
mc.cleanup();
} catch (ResourceException e) {
connectionReturnAction = ConnectionReturnAction.DESTROY;
}
boolean releasePermit;
synchronized (getPool()) {
// a bit redundant, but this closes a small timing hole...
if (destroyed) {
try {
mc.destroy();
}
catch (ResourceException re) {
//ignore
}
return doRemove(mci);
}
if (shrinkLater > 0) {
//nothing can get in the pool while shrinkLater > 0, so releasePermit is false here.
connectionReturnAction = ConnectionReturnAction.DESTROY;
shrinkLater--;
releasePermit = false;
} else if (connectionReturnAction == ConnectionReturnAction.RETURN_HANDLE) {
mci.setLastUsed(System.currentTimeMillis());
doAdd(mci);
return true;
} else {
releasePermit = doRemove(mci);
}
}
//we must destroy connection.
if (log.isLoggable(Level.FINEST)) {
log.log(Level.FINEST,"Discarding connection in pool " + this + " " + connectionInfo);
}
next.returnConnection(connectionInfo, connectionReturnAction);
connectionCount--;
return releasePermit;
}