Skip to content

Commit 835807b

Browse files
authored
fixed closing AQL cursor (#534)
1 parent a2cd855 commit 835807b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: core/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ public <T> ArangoCursor<T> cursor(final String cursorId, final Class<T> type, fi
202202
private <T> ArangoCursor<T> createCursor(
203203
final CursorEntity<T> result,
204204
final Class<T> type,
205-
final AqlQueryOptions options,
205+
final AqlQueryOptions opts,
206206
final HostHandle hostHandle) {
207+
AqlQueryOptions options = opts != null ? opts : new AqlQueryOptions();
207208

208209
final ArangoCursorExecute<T> execute = new ArangoCursorExecute<T>() {
209210
@Override
@@ -223,8 +224,7 @@ public void close(final String id) {
223224
}
224225
}
225226
};
226-
227-
return new ArangoCursorImpl<>(execute, type, result);
227+
return new ArangoCursorImpl<>(execute, type, result, options.getAllowRetry());
228228
}
229229

230230
@Override

Diff for: core/src/main/java/com/arangodb/internal/cursor/ArangoCursorImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ public class ArangoCursorImpl<T> implements ArangoCursor<T> {
4444
private final boolean allowRetry;
4545

4646
public ArangoCursorImpl(final ArangoCursorExecute<T> execute,
47-
final Class<T> type, final CursorEntity<T> result) {
47+
final Class<T> type, final CursorEntity<T> result, final Boolean allowRetry) {
4848
super();
4949
this.execute = execute;
5050
this.type = type;
5151
id = result.getId();
5252
pontentialDirtyRead = result.isPotentialDirtyRead();
5353
iterator = new ArangoCursorIterator<>(id, execute, result);
54-
this.allowRetry = result.getNextBatchId() != null;
54+
this.allowRetry = Boolean.TRUE.equals(allowRetry);
5555
}
5656

5757
@Override

0 commit comments

Comments
 (0)