Fixed bug that can cause a managed connection to be returned from the pool in an inconsistent state
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@708170 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9fd1aa6dc4
commit
0cdd9b7fc2
|
@ -1,3 +1,11 @@
|
|||
Changes since 4.0 beta 1
|
||||
-------------------
|
||||
|
||||
* Fixed bug that can cause a managed connection to be returned from the
|
||||
pool in an inconsistent state.
|
||||
Contributed by Oleg Kalnichevski <olegk at apache.org>
|
||||
|
||||
|
||||
4.0 Beta 1
|
||||
-------------------
|
||||
|
||||
|
|
|
@ -315,6 +315,7 @@ public abstract class AbstractPoolEntry {
|
|||
*/
|
||||
protected void shutdownEntry() {
|
||||
tracker = null;
|
||||
state = null;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -82,6 +82,10 @@ public class BasicPoolEntry extends AbstractPoolEntry {
|
|||
return this.reference;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutdownEntry() {
|
||||
super.shutdownEntry();
|
||||
}
|
||||
|
||||
} // class BasicPoolEntry
|
||||
|
||||
|
|
|
@ -151,15 +151,15 @@ public class RouteSpecificPool {
|
|||
ListIterator<BasicPoolEntry> it = freeEntries.listIterator(freeEntries.size());
|
||||
while (it.hasPrevious()) {
|
||||
BasicPoolEntry entry = it.previous();
|
||||
if (LangUtils.equals(state, entry.getState())) {
|
||||
if (entry.getState() == null || LangUtils.equals(state, entry.getState())) {
|
||||
it.remove();
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!freeEntries.isEmpty()) {
|
||||
if (getCapacity() == 0 && !freeEntries.isEmpty()) {
|
||||
BasicPoolEntry entry = freeEntries.remove();
|
||||
entry.setState(null);
|
||||
entry.shutdownEntry();
|
||||
OperatedClientConnection conn = entry.getConnection();
|
||||
try {
|
||||
conn.close();
|
||||
|
|
Loading…
Reference in New Issue