-
Notifications
You must be signed in to change notification settings - Fork 154
Closed
Description
JdbcPooledConnection.close() says:
// this should never happen, should we throw an exception or log at warn/error?
if (usageCount > 0) {
log.warn("close connection with usage count > 0, " + this);
}
However, should JdbcPooledConnection.getConnectionHandle() throw a SQLException because (e.g.) testConnection() has failed, then usageCount will still have been incremented when XAPool.getConnectionHandle() tries to close the invalid connection.
The patch is trivial:
// Increment the usage count
usageCount++
try {
// etc
} catch (SQLException e) {
// This connection must be invalid, so revert the usage counter.
// Note: Closing a handle with usageCount > 0 "should never happen".
--usageCount;
throw e;
}
Cheers,
Chris
Metadata
Metadata
Assignees
Labels
No labels