@@ -142,7 +142,7 @@ public static HttpClient getOraClient(String userId, String password) {
142142 private static HttpRequestRetryHandler retryHandler () {
143143 return (exception , executionCount , context ) -> {
144144
145- if (executionCount > 3 ) {
145+ if (executionCount > 10 ) {
146146 // Do not retry if over max retries
147147 return false ;
148148 }
@@ -209,17 +209,37 @@ public static Document postCheckConflictRequest(String url, String payload, Stri
209209 // MUST use the same httpExecutor to maintain session
210210
211211
212- httpExecutor
213- .execute (Request .Get (Constants .REL_URL ).connectTimeout (30000 ).socketTimeout (30000 ))
214- .returnContent ().asString ();
212+ boolean complete = false ;
213+ int count = 0 ;
214+ String xmlString = null ;
215+ while (!complete ) {
216+ try {
217+ httpExecutor
218+ .execute (Request .Get (Constants .REL_URL ).connectTimeout (30000 ).socketTimeout (30000 ))
219+ .returnContent ().asString ();
215220
216- HttpEntity entity = MultipartEntityBuilder .create ().setMode (HttpMultipartMode .BROWSER_COMPATIBLE )
217- .addTextBody ("request_xml" , payload )
218- .build ();
221+ HttpEntity entity = MultipartEntityBuilder .create ().setMode (HttpMultipartMode .BROWSER_COMPATIBLE )
222+ .addTextBody ("request_xml" , payload )
223+ .build ();
219224
220- String xmlString =
221- httpExecutor .execute (Request .Post (url ).connectTimeout (30000 ).socketTimeout (30000 ).body (entity ))
225+ xmlString =
226+ httpExecutor .execute (Request .Post (url ).connectTimeout (30000 ).socketTimeout (30000 ).body (entity ))
222227 .returnContent ().asString ();
228+ complete = true ;
229+ } catch (IOException ioe ) {
230+ if (++count > 10 ) {
231+ complete = true ;
232+ } else {
233+ logger .warning ("Network connection failed, retrying in 10 seconds, attempts={0} " , count );
234+ try {
235+ Thread .sleep (10000 );
236+ } catch (InterruptedException e ) {
237+ Thread .currentThread ().interrupt ();
238+ }
239+ }
240+
241+ }
242+ }
223243 logger .exiting ();
224244 return parseXmlString (xmlString );
225245
0 commit comments