Back-out deoptimization. Benchmark shows degradation, which makes sense because

of a new conditional in close() -- the return value of closeOpenStatements() -- which is
'true' 99.999% of the time and therefore the conditional is merely overhead.
pull/395/head
Brett Wooldridge 10 years ago
parent 182c8c58ab
commit dbe9320924

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

Loading…
Cancel
Save