Skip to content

Commit 4626f10

Browse files
authored
fixed retry behavior of HTTP connections in case of timeout exceptions (#429)
1 parent 17cb79a commit 4626f10

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ChangeLog.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## [Unreleased]
88

9+
- fixed retry behavior of HTTP connections in case of timeout exceptions
10+
911
## [6.16.0] - 2022-01-27
1012

1113
- deprecated hash and skiplist indexes (#424)

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.arangodb</groupId>
77
<artifactId>arangodb-java-driver</artifactId>
8-
<version>6.16.0</version>
8+
<version>6.16.1-SNAPSHOT</version>
99
<inceptionYear>2016</inceptionYear>
1010
<packaging>jar</packaging>
1111

src/main/java/com/arangodb/internal/http/HttpCommunication.java

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
import java.io.Closeable;
3434
import java.io.IOException;
35+
import java.net.SocketTimeoutException;
36+
import java.util.concurrent.TimeoutException;
3537

3638
/**
3739
* @author Mark Vollmary
@@ -85,6 +87,13 @@ private Response execute(final Request request, final HostHandle hostHandle, fin
8587
hostHandler.success();
8688
hostHandler.confirm();
8789
return response;
90+
} catch (final SocketTimeoutException e) {
91+
// SocketTimeoutException exceptions are wrapped and rethrown.
92+
// Differently from other IOException exceptions they must not be retried,
93+
// since the requests could not be idempotent.
94+
TimeoutException te = new TimeoutException(e.getMessage());
95+
te.initCause(e);
96+
throw new ArangoDBException(te);
8897
} catch (final IOException e) {
8998
hostHandler.fail(e);
9099
if (hostHandle != null && hostHandle.getHost() != null) {

0 commit comments

Comments
 (0)