if connection is marked for eviction, bypass reset state etc and close

it.
pull/389/head
Nitin 10 years ago
parent fb50c8108c
commit 19896c0619

@ -147,8 +147,9 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
return statement; return statement;
} }
private final void closeOpenStatements() private final boolean closeOpenStatements()
{ {
boolean success = true;
final int size = openStatements.size(); final int size = openStatements.size();
if (size > 0) { if (size > 0) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -160,11 +161,13 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
} }
catch (SQLException e) { catch (SQLException e) {
checkException(e); checkException(e);
success = success ? !poolEntry.evicted : false;
} }
} }
openStatements.clear(); openStatements.clear();
} }
return success;
} }
// ********************************************************************** // **********************************************************************
@ -179,23 +182,23 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
leakTask.cancel(); leakTask.cancel();
try { try {
closeOpenStatements(); if (closeOpenStatements()) {
if (isCommitStateDirty) {
if (isCommitStateDirty) { lastAccess = clockSource.currentTime();
lastAccess = clockSource.currentTime();
if (!poolEntry.isAutoCommit) {
delegate.rollback();
LOGGER.debug("{} - Executed rollback on connection {} due to dirty commit state on close().", poolEntry.parentPool, delegate);
}
}
if (!poolEntry.isAutoCommit) { if (isConnectionStateDirty) {
delegate.rollback(); poolEntry.resetConnectionState();
LOGGER.debug("{} - Executed rollback on connection {} due to dirty commit state on close().", poolEntry.parentPool, delegate); lastAccess = clockSource.currentTime();
} }
}
if (isConnectionStateDirty) { delegate.clearWarnings();
poolEntry.resetConnectionState();
lastAccess = clockSource.currentTime();
} }
delegate.clearWarnings();
} }
catch (SQLException e) { catch (SQLException e) {
// when connections are aborted, exceptions are often thrown that should not reach the application // when connections are aborted, exceptions are often thrown that should not reach the application

Loading…
Cancel
Save