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
This commit is contained in:
parent
dd90fe4685
commit
39a4f616aa
|
@ -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<BasicPoolEntry> leasedConnections;
|
||||
|
||||
/** The list of free connections */
|
||||
protected final Stack<BasicPoolEntry> freeConnections;
|
||||
protected final Queue<BasicPoolEntry> freeConnections;
|
||||
|
||||
/** The list of WaitingThreads waiting for a connection */
|
||||
protected final Queue<WaitingThread> waitingThreads;
|
||||
|
@ -163,8 +162,8 @@ public class ConnPoolByRoute extends AbstractConnPool { //TODO: remove dependenc
|
|||
*
|
||||
* @return a queue
|
||||
*/
|
||||
protected Stack<BasicPoolEntry> createFreeConnQueue() {
|
||||
return new Stack<BasicPoolEntry>();
|
||||
protected Queue<BasicPoolEntry> createFreeConnQueue() {
|
||||
return new LinkedList<BasicPoolEntry>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue