hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1138473 - /httpcomponents/httpclient/branches/trunk-adaptive-connpool/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Date Wed, 22 Jun 2011 14:09:10 GMT
Author: jonm
Date: Wed Jun 22 14:09:09 2011
New Revision: 1138473

URL: http://svn.apache.org/viewvc?rev=1138473&view=rev
Log:
HTTPCLIENT-1101: Do not catch Throwables that come out of executing
through a RequestDirector, but rather limit ourselves to catching
Exceptions and RuntimeExceptions when considering backoff strategies.

Modified:
    httpcomponents/httpclient/branches/trunk-adaptive-connpool/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java

Modified: httpcomponents/httpclient/branches/trunk-adaptive-connpool/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/trunk-adaptive-connpool/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=1138473&r1=1138472&r2=1138473&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/trunk-adaptive-connpool/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
(original)
+++ httpcomponents/httpclient/branches/trunk-adaptive-connpool/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Wed Jun 22 14:09:09 2011
@@ -860,15 +860,18 @@ public abstract class AbstractHttpClient
             HttpResponse out; 
             try {
                 out = director.execute(target, request, execContext);
-            } catch (Throwable t) {
-                if (getConnectionBackoffStrategy().shouldBackoff(t)) {
+            } catch (RuntimeException re) {
+                if (getConnectionBackoffStrategy().shouldBackoff(re)) {
                     getBackoffManager().backOff(route);
                 }
-                if (t instanceof Error) throw (Error)t;
-                if (t instanceof RuntimeException) throw (RuntimeException)t;
-                if (t instanceof HttpException) throw (HttpException)t;
-                if (t instanceof IOException) throw (IOException)t;
-                throw new RuntimeException("unexpected exception", t);
+                throw re;
+            } catch (Exception e) {
+                if (getConnectionBackoffStrategy().shouldBackoff(e)) {
+                    getBackoffManager().backOff(route);
+                }
+                if (e instanceof HttpException) throw (HttpException)e;
+                if (e instanceof IOException) throw (IOException)e;
+                throw new RuntimeException("unexpected exception", e);
             }
             if (getConnectionBackoffStrategy().shouldBackoff(out)) {
                 getBackoffManager().backOff(route);



Mime
View raw message