hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r708170 - in /httpcomponents/httpclient/trunk: ./ module-client/src/main/java/org/apache/http/impl/conn/ module-client/src/main/java/org/apache/http/impl/conn/tsccm/
Date Mon, 27 Oct 2008 13:27:39 GMT
Author: olegk
Date: Mon Oct 27 06:27:39 2008
New Revision: 708170

URL: http://svn.apache.org/viewvc?rev=708170&view=rev
Log:
Fixed bug that can cause a managed connection to be returned from the pool in an inconsistent
state


Modified:
    httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
    httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java

Modified: httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=708170&r1=708169&r2=708170&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Mon Oct 27 06:27:39 2008
@@ -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
 -------------------
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java?rev=708170&r1=708169&r2=708170&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
Mon Oct 27 06:27:39 2008
@@ -315,6 +315,7 @@
      */
     protected void shutdownEntry() { 
         tracker = null;
+        state = null;
     }
 
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java?rev=708170&r1=708169&r2=708170&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
Mon Oct 27 06:27:39 2008
@@ -82,6 +82,10 @@
         return this.reference;
     }
 
+    @Override
+    protected void shutdownEntry() {
+        super.shutdownEntry();
+    }
 
 } // class BasicPoolEntry
 

Modified: httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java?rev=708170&r1=708169&r2=708170&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
(original)
+++ httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/RouteSpecificPool.java
Mon Oct 27 06:27:39 2008
@@ -151,15 +151,15 @@
             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()) {
-            BasicPoolEntry entry = freeEntries.remove();   
-            entry.setState(null);
+        if (getCapacity() == 0 && !freeEntries.isEmpty()) {
+            BasicPoolEntry entry = freeEntries.remove();
+            entry.shutdownEntry();
             OperatedClientConnection conn = entry.getConnection();
             try {
                 conn.close();



Mime
View raw message