Merge branch '2.3.x' into dev

* 2.3.x:
  Fix #289 fixed issue where a connection that was checked-out, never used for longer than the DB connection timeout, and then returned to the pool could bypass the aliveness check and be given to another caller of getConnection().
  Update issue stats badge
pull/307/head
Brett Wooldridge 10 years ago
commit 482c585e13

@ -222,7 +222,6 @@ public class HikariPool implements HikariPoolMBean, IBagStateListener
closeConnection(bagEntry, "connection broken or evicted");
}
else {
bagEntry.lastAccess = System.currentTimeMillis();
connectionBag.requite(bagEntry);
}
}

@ -32,11 +32,11 @@ public final class PoolBagEntry implements IConcurrentBagEntry
public final AtomicInteger state = new AtomicInteger();
public Connection connection;
public long lastAccess;
public long lastOpenTime;
public volatile boolean evicted;
public volatile boolean aborted;
protected long lastAccess;
private volatile ScheduledFuture<?> endOfLife;

@ -51,6 +51,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
private final PoolBagEntry bagEntry;
private final FastList<Statement> openStatements;
private long lastAccess;
private boolean isCommitStateDirty;
private boolean isConnectionStateDirty;
private boolean isAutoCommitDirty;
@ -76,6 +77,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
this.bagEntry = bagEntry;
this.delegate = bagEntry.connection;
this.leakTask = leakTask;
this.lastAccess = bagEntry.lastAccess;
this.openStatements = new FastList<Statement>(Statement.class, 16);
}
@ -131,6 +133,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
public final void markCommitStateDirty()
{
isCommitStateDirty = true;
lastAccess = System.currentTimeMillis();
}
// ***********************************************************************
@ -139,6 +142,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
private final <T extends Statement> T trackStatement(final T statement)
{
lastAccess = System.currentTimeMillis();
openStatements.add(statement);
return statement;
@ -205,6 +209,7 @@ public abstract class ConnectionProxy implements IHikariConnectionProxy
}
finally {
delegate = ClosedConnection.CLOSED_CONNECTION;
bagEntry.lastAccess = lastAccess;
parentPool.releaseConnection(bagEntry);
}
}

Loading…
Cancel
Save