Skip to content

Commit 3d50654

Browse files
committed
fixed VST error handling
1 parent 9de421a commit 3d50654

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

driver/src/main/java/com/arangodb/internal/velocystream/internal/VstConnectionSync.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import javax.net.ssl.SSLContext;
2727
import java.util.Collection;
28+
import java.util.concurrent.ExecutionException;
2829
import java.util.concurrent.FutureTask;
2930
import java.util.concurrent.TimeUnit;
3031

@@ -46,8 +47,13 @@ public Message write(final Message message, final Collection<Chunk> chunks) {
4647
super.writeIntern(message, chunks);
4748
try {
4849
return timeout == null || timeout == 0L ? task.get() : task.get(timeout, TimeUnit.MILLISECONDS);
49-
} catch (final Exception e) {
50+
} catch (final ExecutionException e) {
51+
throw ArangoDBException.wrap(e.getCause());
52+
} catch (InterruptedException e) {
53+
Thread.currentThread().interrupt();
5054
throw new ArangoDBException(e);
55+
} catch (final Exception e) {
56+
throw ArangoDBException.wrap(e);
5157
}
5258
}
5359

resilience-tests/src/test/java/resilience/retry/RetryTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,14 @@ void connectionTimeout(Protocol protocol) throws IOException, InterruptedExcepti
114114

115115

116116
/**
117-
* on closed pending requests of safe HTTP methods: - retry 3 times - ArangoDBMultipleException with 3 exceptions
117+
* on closed pending requests of safe HTTP methods:
118118
* <p>
119-
* once restored: - the subsequent requests should be successful
119+
* - retry 3 times
120+
* - ArangoDBMultipleException with 3 exceptions
121+
* <p>
122+
* once restored:
123+
* <p>
124+
* - the subsequent requests should be successful
120125
*/
121126
@ParameterizedTest
122127
@EnumSource(Protocol.class)
@@ -164,7 +169,6 @@ void retryGetOnClosedConnection(Protocol protocol) throws IOException, Interrupt
164169
@ParameterizedTest
165170
@EnumSource(Protocol.class)
166171
void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, InterruptedException {
167-
assumeTrue(protocol != Protocol.VST);
168172
ArangoDB arangoDB = dbBuilder()
169173
.useProtocol(protocol)
170174
.build();
@@ -182,7 +186,9 @@ void notRetryPostOnClosedConnection(Protocol protocol) throws IOException, Inter
182186
thrown.printStackTrace();
183187
assertThat(thrown).isInstanceOf(ArangoDBException.class);
184188
assertThat(thrown.getCause()).isInstanceOf(IOException.class);
185-
assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class);
189+
if (protocol != Protocol.VST) {
190+
assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class);
191+
}
186192

187193
toxic.remove();
188194
Thread.sleep(100);

resilience-tests/src/test/java/resilience/shutdown/ShutdownTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ void shutdownWithPendingRequests(Protocol protocol) {
4848
ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
4949
es.schedule(arangoDB::shutdown, 200, TimeUnit.MILLISECONDS);
5050
Throwable thrown = catchThrowable(() -> arangoDB.db().query("return sleep(1)", Void.class));
51-
thrown.printStackTrace();
5251
assertThat(thrown).isInstanceOf(ArangoDBException.class);
5352
assertThat(thrown.getCause()).isInstanceOf(IOException.class);
5453
assertThat(thrown.getCause().getCause()).isInstanceOf(HttpClosedException.class);

0 commit comments

Comments
 (0)