From 39a4f616aa34a3d4c43d9e908446f03ec5a58ffa Mon Sep 17 00:00:00 2001 From: Jonathan Moore Date: Wed, 20 Jul 2011 13:45:18 +0000 Subject: [PATCH] HTTPCLIENT-1108: backing out my earlier commit of the FIFO structure, to restore prior functionality. I realized I didn't do this at the right level; we want to do FIFO at the per-route connection pool level but do LIFO at the "all connections" level. Will keep working forward on this. git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1148769 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/http/impl/conn/tsccm/ConnPoolByRoute.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java b/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java index ba0e8d0cb..23898c099 100644 --- a/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java +++ b/httpclient/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java @@ -34,7 +34,6 @@ import java.util.Queue; import java.util.LinkedList; import java.util.Map; import java.util.Set; -import java.util.Stack; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.TimeUnit; @@ -83,7 +82,7 @@ public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependenc protected final Set leasedConnections; /** The list of free connections */ - protected final Stack freeConnections; + protected final Queue freeConnections; /** The list of WaitingThreads waiting for a connection */ protected final Queue waitingThreads; @@ -163,8 +162,8 @@ public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependenc * * @return a queue */ - protected Stack createFreeConnQueue() { - return new Stack(); + protected Queue createFreeConnQueue() { + return new LinkedList(); } /** @@ -463,7 +462,7 @@ public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependenc } rospl.freeEntry(entry); entry.updateExpiry(validDuration, timeUnit); - freeConnections.push(entry); + freeConnections.add(entry); } else { rospl.dropEntry(); numConnections--; @@ -612,7 +611,7 @@ public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependenc poolLock.lock(); try { - BasicPoolEntry entry = freeConnections.pop(); + BasicPoolEntry entry = freeConnections.remove(); if (entry != null) { deleteEntry(entry);