Skip to content

Commit a76d064

Browse files
author
a-brandt
committed
Revert "bugfix reconnect (issue #25)"
This reverts commit a2e2c78.
1 parent a2e2c78 commit a76d064

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

src/main/java/com/arangodb/http/HttpManager.java

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.apache.http.HttpResponse;
3434
import org.apache.http.HttpStatus;
3535
import org.apache.http.NameValuePair;
36-
import org.apache.http.NoHttpResponseException;
3736
import org.apache.http.StatusLine;
3837
import org.apache.http.auth.AuthenticationException;
3938
import org.apache.http.auth.Credentials;
@@ -353,29 +352,24 @@ public HttpResponseEntity execute(HttpRequestEntity requestEntity) throws Arango
353352
try {
354353
return executeInternal(configure.getBaseUrl(), requestEntity);
355354
} catch (SocketException ex) {
356-
handleException(++retries, connectRetryCount, ex);
357-
} catch (NoHttpResponseException ex) {
358-
handleException(++retries, connectRetryCount, ex);
359-
}
360-
}
361-
}
362-
363-
private void handleException(int retries, int connectRetryCount, Exception ex) throws ArangoException {
364-
if (connectRetryCount > 0 && retries > connectRetryCount) {
365-
logger.error(ex.getMessage(), ex);
366-
throw new ArangoException(ex);
367-
}
355+
retries++;
356+
if (connectRetryCount > 0 && retries > connectRetryCount) {
357+
logger.error(ex.getMessage(), ex);
358+
throw new ArangoException(ex);
359+
}
368360

369-
if (configure.hasFallbackHost()) {
370-
configure.changeCurrentHost();
371-
}
361+
if (configure.hasFallbackHost()) {
362+
configure.changeCurrentHost();
363+
}
372364

373-
logger.warn(ex.getMessage(), ex);
374-
try {
375-
// 1000 milliseconds is one second.
376-
Thread.sleep(configure.getConnectRetryWait());
377-
} catch (InterruptedException iex) {
378-
Thread.currentThread().interrupt();
365+
logger.warn(ex.getMessage(), ex);
366+
try {
367+
// 1000 milliseconds is one second.
368+
Thread.sleep(configure.getConnectRetryWait());
369+
} catch (InterruptedException iex) {
370+
Thread.currentThread().interrupt();
371+
}
372+
}
379373
}
380374
}
381375

@@ -386,10 +380,9 @@ private void handleException(int retries, int connectRetryCount, Exception ex) t
386380
* the request
387381
* @return the response of the request
388382
* @throws ArangoException
389-
* @throws NoHttpResponseException
390383
*/
391384
private HttpResponseEntity executeInternal(String baseUrl, HttpRequestEntity requestEntity)
392-
throws ArangoException, SocketException, NoHttpResponseException {
385+
throws ArangoException, SocketException {
393386

394387
String url = buildUrl(baseUrl, requestEntity);
395388

@@ -437,16 +430,12 @@ private HttpResponseEntity executeInternal(String baseUrl, HttpRequestEntity req
437430
return responseEntity;
438431
}
439432

440-
private HttpResponse executeRequest(HttpRequestBase request)
441-
throws SocketException, ArangoException, NoHttpResponseException {
433+
private HttpResponse executeRequest(HttpRequestBase request) throws SocketException, ArangoException {
442434
try {
443435
return client.execute(request);
444436
} catch (SocketException ex) {
445437
// catch SocketException before IOException
446438
throw ex;
447-
} catch (NoHttpResponseException ex) {
448-
// catch NoHttpResponseException before IOException
449-
throw ex;
450439
} catch (ClientProtocolException e) {
451440
throw new ArangoException(e);
452441
} catch (IOException e) {

0 commit comments

Comments
 (0)