Skip to content
Permalink
Browse files
GERONIMO-5754 timing window for expired connections
  • Loading branch information
djencks committed Jan 13, 2011
1 parent 191f34b commit a57f27869b81b4efa5371aa4450dd593aab8e960
Showing 3 changed files with 10 additions and 3 deletions.
@@ -375,7 +375,7 @@ public void run() {
interceptor.getExpiredManagedConnectionInfos(threshold, killList);
for (ManagedConnectionInfo managedConnectionInfo : killList) {
ConnectionInfo killInfo = new ConnectionInfo(managedConnectionInfo);
interceptor.internalReturn(killInfo, ConnectionReturnAction.DESTROY);
parent.next.returnConnection(killInfo, ConnectionReturnAction.DESTROY);
}
} catch (Throwable t) {
log.error("Error occurred during execution of ExpirationMonitor TimerTask", t);
@@ -19,6 +19,7 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import javax.resource.ResourceException;
@@ -160,9 +161,12 @@ public int getIdleConnectionCount() {

protected void getExpiredManagedConnectionInfos(long threshold, List<ManagedConnectionInfo> killList) {
synchronized (pool) {
for (ManagedConnectionInfo mci : pool) {
for (Iterator<ManagedConnectionInfo> mcis = pool.iterator(); mcis.hasNext(); ) {
ManagedConnectionInfo mci = mcis.next();
if (mci.getLastUsed() < threshold) {
mcis.remove();
killList.add(mci);
connectionCount--;
}
}
}
@@ -140,9 +140,12 @@ protected void transferConnections(int maxSize, int shrinkNow) {

protected void getExpiredManagedConnectionInfos(long threshold, List<ManagedConnectionInfo> killList) {
synchronized (pool) {
for (ManagedConnectionInfo mci : pool.values()) {
for (Iterator<Map.Entry<ManagedConnection, ManagedConnectionInfo>> mcis = pool.entrySet().iterator(); mcis.hasNext(); ) {
ManagedConnectionInfo mci = mcis.next().getValue();
if (mci.getLastUsed() < threshold) {
mcis.remove();
killList.add(mci);
connectionCount--;
}
}
}

0 comments on commit a57f278

Please sign in to comment.