hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1133033 - in /httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio: client/DefaultAsyncRequestDirector.java conn/ClientConnAdaptor.java conn/DefaultClientConnection.java pool/SessionPool.java
Date Tue, 07 Jun 2011 14:47:49 GMT
Author: olegk
Date: Tue Jun  7 14:47:48 2011
New Revision: 1133033

URL: http://svn.apache.org/viewvc?rev=1133033&view=rev
Log:
Fixed handling of closed connections

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/ClientConnAdaptor.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientConnection.java
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/pool/SessionPool.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java?rev=1133033&r1=1133032&r2=1133033&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultAsyncRequestDirector.java
Tue Jun  7 14:47:48 2011
@@ -377,6 +377,7 @@ class DefaultAsyncRequestDirector<T> imp
                 }
                 this.managedConn.setIdleDuration(duration, TimeUnit.MILLISECONDS);
             } else {
+                this.managedConn.markNonReusable();
                 releaseConnection();
                 invalidateAuthIfSuccessful(this.proxyAuthState);
                 invalidateAuthIfSuccessful(this.targetAuthState);

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/ClientConnAdaptor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/ClientConnAdaptor.java?rev=1133033&r1=1133032&r2=1133033&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/ClientConnAdaptor.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/ClientConnAdaptor.java
Tue Jun  7 14:47:48 2011
@@ -128,7 +128,7 @@ class ClientConnAdaptor implements Manag
     }
 
     public boolean isReusable() {
-        return this.reusable;
+        return this.reusable && this.conn != null && this.conn.isOpen();
     }
 
     public synchronized void markNonReusable() {

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientConnection.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientConnection.java?rev=1133033&r1=1133032&r2=1133033&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientConnection.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/conn/DefaultClientConnection.java
Tue Jun  7 14:47:48 2011
@@ -117,7 +117,22 @@ public class DefaultClientConnection
 
     @Override
     public String toString() {
-        return this.id;
+        StringBuilder buf = new StringBuilder();
+        buf.append(this.id);
+        buf.append(" [");
+        switch (this.status) {
+        case ACTIVE:
+            buf.append("ACTIVE");
+            break;
+        case CLOSING:
+            buf.append("CLOSING");
+            break;
+        case CLOSED:
+            buf.append("CLOSED");
+            break;
+        }
+        buf.append("]");
+        return buf.toString();
     }
 
     class LoggingNHttpMessageWriter implements NHttpMessageWriter<HttpRequest> {

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/pool/SessionPool.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/pool/SessionPool.java?rev=1133033&r1=1133032&r2=1133033&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/pool/SessionPool.java
(original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/pool/SessionPool.java
Tue Jun  7 14:47:48 2011
@@ -176,9 +176,6 @@ public abstract class SessionPool<T, E e
                 pool.freeEntry(entry, reusable);
                 if (reusable) {
                     this.availableSessions.add(entry);
-                } else {
-                    IOSession iosession = entry.getIOSession();
-                    iosession.close();
                 }
                 processPendingRequests();
             }



Mime
View raw message