You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ro...@apache.org on 2007/09/22 09:23:01 UTC

svn commit: r578385 - in /jakarta/httpcomponents/httpclient/trunk: ./ module-client/src/main/java/org/apache/http/impl/conn/tsccm/

Author: rolandw
Date: Sat Sep 22 00:22:57 2007
New Revision: 578385

URL: http://svn.apache.org/viewvc?rev=578385&view=rev
Log:
HTTPCLIENT-692: TSCCM throws InterruptedException

Modified:
    jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java

Modified: jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?rev=578385&r1=578384&r2=578385&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Sat Sep 22 00:22:57 2007
@@ -1,5 +1,8 @@
 Changes since release 4.0 Alpha 1
 
+* [HTTPCLIENT-692] ClientConnectionManager throws InterruptedException
+  Contributed by Roland Weber <rolandw at apache.org>
+
 * [HTTPCORE-116] moved parameter names to interfaces
   Contributed by Roland Weber <rolandw at apache.org>
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java?rev=578385&r1=578384&r2=578385&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java Sat Sep 22 00:22:57 2007
@@ -156,11 +156,13 @@
      *
      * @throws ConnectionPoolTimeoutException
      *         if the timeout expired
+     * @throws InterruptedException
+     *         if the calling thread was interrupted
      */
     public abstract
         BasicPoolEntry getEntry(HttpRoute route, long timeout,
                                 ClientConnectionOperator operator)
-        throws ConnectionPoolTimeoutException
+        throws ConnectionPoolTimeoutException, InterruptedException
         ;
 
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java?rev=578385&r1=578384&r2=578385&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ConnPoolByRoute.java Sat Sep 22 00:22:57 2007
@@ -167,7 +167,7 @@
     public synchronized
         BasicPoolEntry getEntry(HttpRoute route, long timeout,
                                 ClientConnectionOperator operator)
-        throws ConnectionPoolTimeoutException {
+        throws ConnectionPoolTimeoutException, InterruptedException {
 
         BasicPoolEntry entry = null;
 
@@ -245,8 +245,7 @@
                 } catch (InterruptedException e) {
                     if (!waitingThread.interruptedByConnectionPool) {
                         LOG.debug("Interrupted while waiting for connection.", e);
-                        throw new IllegalThreadStateException(
-                            "Interrupted while waiting in " + this);
+                        throw e;
                     }
                     // Else, do nothing, we were interrupted by the
                     // connection pool and should now have a connection

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java?rev=578385&r1=578384&r2=578385&view=diff
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java (original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/tsccm/ThreadSafeClientConnManager.java Sat Sep 22 00:22:57 2007
@@ -141,19 +141,19 @@
 
     
     // non-javadoc, see interface ClientConnectionManager
-    public ManagedClientConnection getConnection(HttpRoute route) {
+    public ManagedClientConnection getConnection(HttpRoute route)
+        throws InterruptedException {
 
         while (true) {
             try {
                 return getConnection(route, 0);
             } catch (ConnectionPoolTimeoutException e) {
                 // We'll go ahead and log this, but it should never happen.
-                // Exceptions are only thrown when the timeout occurs and
-                // since we have no timeout, it doesn't happen.
-                LOG.debug(
-                    "Unexpected exception while waiting for connection",
-                    e
-                    );
+                // These exceptions are only thrown when the timeout occurs
+                // and since we have no timeout, it doesn't happen.
+                LOG.debug
+                    ("Unexpected exception while waiting for connection", e);
+                //@@@ throw RuntimeException or Error to indicate the problem?
             }
         }
     }
@@ -162,7 +162,7 @@
     // non-javadoc, see interface ClientConnectionManager
     public ManagedClientConnection getConnection(HttpRoute route,
                                                  long timeout)
-        throws ConnectionPoolTimeoutException {
+        throws ConnectionPoolTimeoutException, InterruptedException {
 
         if (route == null) {
             throw new IllegalArgumentException("Route may not be null.");