bitronix/btm — pull request #21 by rankinc (2014-04-01 23:23:05+00:00)
Title: Closing a connection with "usageCount > 1" is actually possible.

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 an exception because (e.g.) testConnection() has failed, then usageCount will still have been incremented when XAPool.getConnectionHandle() tries to close the invalid connection.