You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/10/13 14:18:23 UTC

svn commit: r1531677 - /httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java

Author: olegk
Date: Sun Oct 13 12:18:22 2013
New Revision: 1531677

URL: http://svn.apache.org/r1531677
Log:
HTTPASYNC-56: fixed connection leak introduced by r1531544

Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java?rev=1531677&r1=1531676&r2=1531677&view=diff
==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient/src/main/java/org/apache/http/impl/nio/client/DefaultClientExchangeHandlerImpl.java Sun Oct 13 12:18:22 2013
@@ -203,6 +203,19 @@ class DefaultClientExchangeHandlerImpl<T
                 this.connmgr.releaseConnection(localConn,
                         this.localContext.getUserToken(),
                         this.state.getValidDuration(), TimeUnit.MILLISECONDS);
+            } else {
+                try {
+                    localConn.close();
+                    if (this.log.isDebugEnabled()) {
+                        this.log.debug("[exchange: " + this.state.getId() + "] connection discarded");
+                    }
+                } catch (final IOException ex) {
+                    if (this.log.isDebugEnabled()) {
+                        this.log.debug(ex.getMessage(), ex);
+                    }
+                } finally {
+                    this.connmgr.releaseConnection(localConn, null, 0, TimeUnit.MILLISECONDS);
+                }
             }
         }
     }
@@ -213,7 +226,7 @@ class DefaultClientExchangeHandlerImpl<T
             try {
                 localConn.shutdown();
                 if (this.log.isDebugEnabled()) {
-                    this.log.debug("[exchange: " + this.state.getId() + "] connection discarded");
+                    this.log.debug("[exchange: " + this.state.getId() + "] connection aborted");
                 }
             } catch (final IOException ex) {
                 if (this.log.isDebugEnabled()) {