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,8 +182,7 @@ 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();
@ -197,6 +199,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
delegate.clearWarnings(); 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
if (!poolEntry.aborted) { if (!poolEntry.aborted) {

Loading…
Cancel
Save