[jboss-svn-commits] JBL Code SVN: r34651 - labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Aug 11 18:12:25 EDT 2010


Author: kevin.conner at jboss.com
Date: 2010-08-11 18:12:25 -0400 (Wed, 11 Aug 2010)
New Revision: 34651

Modified:
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/AbstractHttpMethodFactory.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/GETHttpMethodFactory.java
   labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/POSTHttpMethodFactory.java
Log:
Pulled across fix for SOAPProxy Service with unreachable proxy URL causes server to hang : JBESB-3458

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/AbstractHttpMethodFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/AbstractHttpMethodFactory.java	2010-08-11 21:12:58 UTC (rev 34650)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/AbstractHttpMethodFactory.java	2010-08-11 22:12:25 UTC (rev 34651)
@@ -19,8 +19,14 @@
  */
 package org.jboss.soa.esb.actions.routing.http;
 
+import java.io.IOException;
+import java.net.SocketException;
 import java.net.URL;
 
+import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.HttpMethodRetryHandler;
+import org.apache.commons.httpclient.params.HttpMethodParams;
 import org.jboss.soa.esb.ConfigurationException;
 import org.jboss.soa.esb.helpers.ConfigTree;
 
@@ -54,5 +60,28 @@
     }
     
     public void setConfiguration(ConfigTree config) throws ConfigurationException {}
-
+    
+    protected void wrapRetryHandler(HttpMethod method) {
+    	HttpMethodParams params = method.getParams();
+    	HttpMethodRetryHandler other = (HttpMethodRetryHandler)params.getParameter(HttpMethodParams.RETRY_HANDLER);
+    	params.setParameter(HttpMethodParams.RETRY_HANDLER, new HttpMethodRetryHandlerWrapper(other));
+    }
+    
+    private static class HttpMethodRetryHandlerWrapper implements HttpMethodRetryHandler {
+    	
+    	private HttpMethodRetryHandler other;
+    	
+    	private HttpMethodRetryHandlerWrapper(HttpMethodRetryHandler other) {
+    		this.other = (other != null ? other : new DefaultHttpMethodRetryHandler());
+    	}
+    	
+    	public boolean retryMethod(HttpMethod method, IOException exception, int executionCount) {
+    		boolean retry = other.retryMethod(method, exception, executionCount);
+    		if (retry && exception instanceof SocketException) {
+    			retry = false;
+    		}
+    		return retry;
+    	}
+    	
+    }
 }

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/GETHttpMethodFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/GETHttpMethodFactory.java	2010-08-11 21:12:58 UTC (rev 34650)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/GETHttpMethodFactory.java	2010-08-11 22:12:25 UTC (rev 34651)
@@ -33,6 +33,8 @@
 public class GETHttpMethodFactory extends AbstractHttpMethodFactory {
 
     public HttpMethodBase getInstance(Message message) throws IOException {
-        return new GetMethod( getEndpointPathAndQuery() );
+    	GetMethod method = new GetMethod( getEndpointPathAndQuery() );
+    	wrapRetryHandler(method);
+    	return method;
     }
 }
\ No newline at end of file

Modified: labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/POSTHttpMethodFactory.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/POSTHttpMethodFactory.java	2010-08-11 21:12:58 UTC (rev 34650)
+++ labs/jbossesb/branches/JBESB_4_7_CP/product/rosetta/src/org/jboss/soa/esb/actions/routing/http/POSTHttpMethodFactory.java	2010-08-11 22:12:25 UTC (rev 34651)
@@ -83,6 +83,7 @@
         }
 
         method.setRequestEntity(entity);
+        wrapRetryHandler(method);
         return method;
     }
 }
\ No newline at end of file



More information about the jboss-svn-commits mailing list