Skip to content

Commit cccb2cb

Browse files
author
Achim Brandt
committed
added default batchSize to configuration
1 parent 79aa0f0 commit cccb2cb

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/main/java/com/arangodb/ArangoConfigure.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ public class ArangoConfigure {
9595

9696
boolean staleConnectionCheck = false;
9797

98+
/**
99+
* the default ArangoDB cursor batch size
100+
*/
101+
private int batchSize = 20;
102+
98103
BatchHttpManager httpManager;
99104

100105
public ArangoConfigure() {
@@ -237,6 +242,11 @@ public void loadProperties(String propertyPath) {
237242
setStaleConnectionCheck(Boolean.parseBoolean(staleConnectionCheck));
238243
}
239244

245+
String batchSize = prop.getProperty("batchSize");
246+
if (batchSize != null) {
247+
setBatchSize(Integer.parseInt(batchSize));
248+
}
249+
240250
}
241251
} catch (IOException e) {
242252
logger.warn("load property error", e);
@@ -567,4 +577,12 @@ public void setConnectRetryWait(int connectRetryWait) {
567577
this.connectRetryWait = connectRetryWait;
568578
}
569579

580+
public int getBatchSize() {
581+
return batchSize;
582+
}
583+
584+
public void setBatchSize(int batchSize) {
585+
this.batchSize = batchSize;
586+
}
587+
570588
}

src/main/java/com/arangodb/ArangoDriver.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import com.arangodb.entity.BatchResponseEntity;
3232
import com.arangodb.entity.BooleanResultEntity;
3333
import com.arangodb.entity.CollectionEntity;
34+
import com.arangodb.entity.CollectionKeyOption;
3435
import com.arangodb.entity.CollectionOptions;
3536
import com.arangodb.entity.CollectionsEntity;
3637
import com.arangodb.entity.CursorEntity;
@@ -2307,7 +2308,7 @@ public <T> CursorEntity<T> executeCursorEntityQuery(
23072308
* @return default AqlQueryOptions object
23082309
*/
23092310
public AqlQueryOptions getDefaultAqlQueryOptions() {
2310-
return new AqlQueryOptions().setBatchSize(20).setCount(false).setFullCount(false);
2311+
return new AqlQueryOptions().setBatchSize(configure.getBatchSize()).setCount(false).setFullCount(false);
23112312
}
23122313

23132314
/**

0 commit comments

Comments
 (0)