add transaction for setDiscarded
@@ -96,9 +96,13 @@ public class DalConnectionPool extends ConnectionPool {
@Override
protected void returnConnection(PooledConnection con) {
try {
- if (con.getConnection().isClosed()) {
+ if (con.getConnection().isClosed() && !con.isDiscarded()) {
con.setDiscarded(true);
- logger.info(String.format("set discarded for %s", getName()));
+ String poolUrl = con.getPoolProperties().getUrl();
+ String connUrl = ConnectionUtils.getConnectionUrl(con.getConnection(), poolUrl);
+ String logName = String.format("Connection::discardConnection:%s", connUrl);
+ logger.logTransaction(DalLogTypes.DAL_DATASOURCE, logName, poolUrl, System.currentTimeMillis());
+ logger.warn(String.format("Connection marked discarded: %s", connUrl));
}
} catch (SQLException e) {
logger.error("[returnConnection]" + this, e);
