Skip to content

Commit 31f820d

Browse files
author
mpv1989
committed
Fix ArangoCursor#next when performing a dirty read
1 parent b13e005 commit 31f820d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## [Unreleased]
88

9+
### Fixed
10+
11+
- fixed `ArangoCursor#next` when performing a dirty read
12+
- fixed connection stickiness
13+
914
## [5.0.0] - 2018-09-18
1015

1116
### Added

src/main/java/com/arangodb/internal/ArangoDatabaseAsyncImpl.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public <T> CompletableFuture<ArangoCursorAsync<T>> query(
187187
final HostHandle hostHandle = new HostHandle();
188188
final CompletableFuture<CursorEntity> execution = executor.execute(request, CursorEntity.class, hostHandle);
189189
return execution.thenApply(result -> {
190-
return createCursor(result, type, hostHandle);
190+
return createCursor(result, type, options, hostHandle);
191191
});
192192
}
193193

@@ -217,21 +217,22 @@ public <T> CompletableFuture<ArangoCursorAsync<T>> query(final String query, fin
217217
public <T> CompletableFuture<ArangoCursorAsync<T>> cursor(final String cursorId, final Class<T> type)
218218
throws ArangoDBException {
219219
final HostHandle hostHandle = new HostHandle();
220-
final CompletableFuture<CursorEntity> execution = executor.execute(queryNextRequest(cursorId),
220+
final CompletableFuture<CursorEntity> execution = executor.execute(queryNextRequest(cursorId, null),
221221
CursorEntity.class, hostHandle);
222222
return execution.thenApply(result -> {
223-
return createCursor(result, type, hostHandle);
223+
return createCursor(result, type, null, hostHandle);
224224
});
225225
}
226226

227227
private <T> ArangoCursorAsync<T> createCursor(
228228
final CursorEntity result,
229229
final Class<T> type,
230+
final AqlQueryOptions options,
230231
final HostHandle hostHandle) {
231232
return new ArangoCursorAsyncImpl<>(this, new ArangoCursorExecute() {
232233
@Override
233234
public CursorEntity next(final String id) {
234-
final CompletableFuture<CursorEntity> result = executor.execute(queryNextRequest(id),
235+
final CompletableFuture<CursorEntity> result = executor.execute(queryNextRequest(id, options),
235236
CursorEntity.class, hostHandle);
236237
try {
237238
return result.get();
@@ -243,7 +244,7 @@ public CursorEntity next(final String id) {
243244
@Override
244245
public void close(final String id) {
245246
try {
246-
executor.execute(queryCloseRequest(id), Void.class, hostHandle).get();
247+
executor.execute(queryCloseRequest(id, options), Void.class, hostHandle).get();
247248
} catch (InterruptedException | ExecutionException e) {
248249
throw new ArangoDBException(e);
249250
}

0 commit comments

Comments
 (0)