}
try
{
// Check we weren't racing with another transaction
ConnectionListener other =
(ConnectionListener)tsr.getResource(new TransactionKey(trackByTransaction));
if (other != null)
{
mcp.returnConnection(cl, false);
log.tracef("Another thread already got a connection tracked by transaction=%s tx=%s",
other, trackByTransaction);
cl = other;
}
// This is the connection for this transaction
cl.setTrackByTx(true);
tsr.putResource(new TransactionKey(trackByTransaction), cl);
log.tracef("Using connection from pool tracked by transaction=%s tx=%s", cl, trackByTransaction);
return cl;
}