Skip to content

Conversation

rankinc
Copy link
Contributor

@rankinc rankinc commented Apr 1, 2014

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.

…owever, it can happen if JdbcPooledConnection.getConnectionHandle() throws an exception - e.g. if testConnection() fails. So ensure that JdbcPooledConnection.getConnectionHandle() decrements usageCount again if it fails, and sets the connection's state to NOT_ACCESSIBLE.

This fix is currently only for "correctness" w.r.t. JdbcPooledConnection's documented semantics. The only visible effect is seeing fewer warnings in the log.
@rankinc
Copy link
Contributor Author

rankinc commented Apr 2, 2014

Could someone rerun this Travis CI build please? GitHub was having difficulty cloning repositories last night.

@rankinc
Copy link
Contributor Author

rankinc commented Apr 2, 2014

The build failure here is the same one that is fixed by the unit-test-jdk7 feature branch.

rankinc added 4 commits May 24, 2014 13:06
Conflicts:
	btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Conflicts:
	btm/src/main/java/bitronix/tm/resource/jdbc/JdbcPooledConnection.java
Fix references to XA states in comments, and remove unused import.
More final variables and @OverRide annotations.
Add generic types to List and Iterator.
timlinquist pushed a commit to timlinquist/btm that referenced this pull request Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant