cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1729217 - in /cxf/web: pom.xml src/main/java/org/apache/cxf/cwiki/SiteExporter.java
Date Mon, 08 Feb 2016 17:41:11 GMT
Author: dkulp
Date: Mon Feb  8 17:41:11 2016
New Revision: 1729217

URL: http://svn.apache.org/viewvc?rev=1729217&view=rev
Log:
Attempt to reduce the number of build failures by using the CXF retry strategy

Modified:
    cxf/web/pom.xml
    cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java

Modified: cxf/web/pom.xml
URL: http://svn.apache.org/viewvc/cxf/web/pom.xml?rev=1729217&r1=1729216&r2=1729217&view=diff
==============================================================================
--- cxf/web/pom.xml (original)
+++ cxf/web/pom.xml Mon Feb  8 17:41:11 2016
@@ -63,6 +63,11 @@
             <version>${cxf.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-features-clustering</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.apache.velocity</groupId>
             <artifactId>velocity</artifactId>
         </dependency>

Modified: cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java
URL: http://svn.apache.org/viewvc/cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java?rev=1729217&r1=1729216&r2=1729217&view=diff
==============================================================================
--- cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java (original)
+++ cxf/web/src/main/java/org/apache/cxf/cwiki/SiteExporter.java Mon Feb  8 17:41:11 2016
@@ -75,16 +75,18 @@ import com.fasterxml.jackson.core.JsonFa
 import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonToken;
 
-
+import org.apache.cxf.clustering.FailoverFeature;
+import org.apache.cxf.clustering.RetryStrategy;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.util.Base64Utility;
+import org.apache.cxf.feature.Feature;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.FileUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.interceptor.LoggingOutInterceptor;
-import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
+import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.transport.http.HTTPConduit;
 import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
@@ -204,14 +206,32 @@ public class SiteExporter implements Run
     
     public static synchronized ContentResource getContentResource() {
         if (contentResource == null) {
-            contentResource = JAXRSClientFactory.create(REST_API, ContentResource.class,

-                                                        userName, password, null);
+            FailoverFeature failover = new FailoverFeature();
+            RetryStrategy rs = new RetryStrategy();
+            rs.setMaxNumberOfRetries(25);
+            failover.setStrategy(rs);
+            JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
+            bean.setAddress(REST_API);
+            bean.setServiceClass(ContentResource.class);
+            List<Feature> features = new ArrayList<Feature>();
+            features.add(failover);
+            bean.setFeatures(features);
+            bean.setUsername(userName);
+            bean.setPassword(password);
+            contentResource = bean.create(ContentResource.class);
         }
         return contentResource;
     }
     public static synchronized Dispatch<Document> getDispatch() {
         if (dispatch == null) {
-            Service service = Service.create(new QName(SOAPNS, "Service"));
+            
+            FailoverFeature failover = new FailoverFeature();
+            RetryStrategy rs = new RetryStrategy();
+            rs.setMaxNumberOfRetries(25);
+            failover.setStrategy(rs);
+            
+            
+            Service service = Service.create(new QName(SOAPNS, "Service"), failover);
             service.addPort(new QName(SOAPNS, "Port"), 
                             SOAPBinding.SOAP11HTTP_BINDING,
                             ROOT + RPC_ROOT + apiVersion);



Mime
View raw message