@@ -75,7 +75,9 @@ public final class Config implements Serializable {
75
75
76
76
private static final Config EMPTY = builder ().build ();
77
77
78
- /** User defined logging */
78
+ /**
79
+ * User defined logging
80
+ */
79
81
private final Logging logging ;
80
82
81
83
private final boolean logLeakedSessions ;
@@ -90,9 +92,9 @@ public final class Config implements Serializable {
90
92
91
93
private final long fetchSize ;
92
94
private final long routingTablePurgeDelayMillis ;
95
+ private final long maxTransactionRetryTimeMillis ;
93
96
94
97
private final int connectionTimeoutMillis ;
95
- private final long maxTransactionRetryTime ;
96
98
private final ServerAddressResolver resolver ;
97
99
98
100
private final int eventLoopThreads ;
@@ -113,7 +115,7 @@ private Config(ConfigBuilder builder) {
113
115
114
116
this .connectionTimeoutMillis = builder .connectionTimeoutMillis ;
115
117
this .routingTablePurgeDelayMillis = builder .routingTablePurgeDelayMillis ;
116
- this .maxTransactionRetryTime = builder .maxTransactionRetryTime ;
118
+ this .maxTransactionRetryTimeMillis = builder .maxTransactionRetryTimeMillis ;
117
119
this .resolver = builder .resolver ;
118
120
this .fetchSize = builder .fetchSize ;
119
121
@@ -123,6 +125,7 @@ private Config(ConfigBuilder builder) {
123
125
124
126
/**
125
127
* Logging provider
128
+ *
126
129
* @return the Logging provider to use
127
130
*/
128
131
public Logging logging () {
@@ -211,12 +214,22 @@ public static Config defaultConfig() {
211
214
return EMPTY ;
212
215
}
213
216
214
- public long routingTablePurgeDelay () {
217
+ /**
218
+ * Returns stale routing table purge delay.
219
+ *
220
+ * @return routing table purge delay
221
+ */
222
+ public long routingTablePurgeDelayMillis () {
215
223
return routingTablePurgeDelayMillis ;
216
224
}
217
225
218
- public long maxTransactionRetryTime () {
219
- return maxTransactionRetryTime ;
226
+ /**
227
+ * Returns managed transactions maximum retry time.
228
+ *
229
+ * @return maximum retry time
230
+ */
231
+ public long maxTransactionRetryTimeMillis () {
232
+ return maxTransactionRetryTimeMillis ;
220
233
}
221
234
222
235
public long fetchSize () {
@@ -260,7 +273,7 @@ public static final class ConfigBuilder {
260
273
new SecuritySettings .SecuritySettingsBuilder ();
261
274
private long routingTablePurgeDelayMillis = RoutingSettings .STALE_ROUTING_TABLE_PURGE_DELAY_MS ;
262
275
private int connectionTimeoutMillis = (int ) TimeUnit .SECONDS .toMillis (30 );
263
- private long maxTransactionRetryTime = ExponentialBackoffRetryLogic .DEFAULT_MAX_RETRY_TIME_MS ;
276
+ private long maxTransactionRetryTimeMillis = ExponentialBackoffRetryLogic .DEFAULT_MAX_RETRY_TIME_MS ;
264
277
private ServerAddressResolver resolver ;
265
278
private MetricsAdapter metricsAdapter = MetricsAdapter .DEV_NULL ;
266
279
private long fetchSize = FetchSizeUtil .DEFAULT_FETCH_SIZE ;
@@ -324,7 +337,7 @@ public ConfigBuilder withLeakedSessionsLogging() {
324
337
* validity and negative values mean connections will never be tested.
325
338
*
326
339
* @param value the minimum idle time
327
- * @param unit the unit in which the duration is given
340
+ * @param unit the unit in which the duration is given
328
341
* @return this builder
329
342
*/
330
343
public ConfigBuilder withConnectionLivenessCheckTimeout (long value , TimeUnit unit ) {
@@ -349,7 +362,7 @@ public ConfigBuilder withConnectionLivenessCheckTimeout(long value, TimeUnit uni
349
362
* checked.
350
363
*
351
364
* @param value the maximum connection lifetime
352
- * @param unit the unit in which the duration is given
365
+ * @param unit the unit in which the duration is given
353
366
* @return this builder
354
367
*/
355
368
public ConfigBuilder withMaxConnectionLifetime (long value , TimeUnit unit ) {
@@ -395,7 +408,7 @@ public ConfigBuilder withMaxConnectionPoolSize(int value) {
395
408
* of {@code 0} is allowed and results in no timeout and immediate failure when connection is unavailable.
396
409
*
397
410
* @param value the acquisition timeout
398
- * @param unit the unit in which the duration is given
411
+ * @param unit the unit in which the duration is given
399
412
* @return this builder
400
413
* @see #withMaxConnectionPoolSize(int)
401
414
*/
@@ -411,6 +424,7 @@ public ConfigBuilder withConnectionAcquisitionTimeout(long value, TimeUnit unit)
411
424
412
425
/**
413
426
* Set to use encrypted traffic.
427
+ *
414
428
* @return this builder
415
429
*/
416
430
public ConfigBuilder withEncryption () {
@@ -420,6 +434,7 @@ public ConfigBuilder withEncryption() {
420
434
421
435
/**
422
436
* Set to use unencrypted traffic.
437
+ *
423
438
* @return this builder
424
439
*/
425
440
public ConfigBuilder withoutEncryption () {
@@ -454,13 +469,12 @@ public ConfigBuilder withTrustStrategy(TrustStrategy trustStrategy) {
454
469
* The routing table of a database get refreshed if the database is used frequently.
455
470
* If the database is not used for a long time,
456
471
* the driver use the timeout specified here to purge the stale routing table.
457
- *
472
+ * <p>
458
473
* After a routing table is removed, next time when using the database of the purged routing table,
459
474
* the driver will fall back to use seed URI for a new routing table.
460
- * @param delay
461
- * the amount of time to wait before purging routing tables
462
- * @param unit
463
- * the unit in which the duration is given
475
+ *
476
+ * @param delay the amount of time to wait before purging routing tables
477
+ * @param unit the unit in which the duration is given
464
478
* @return this builder
465
479
*/
466
480
public ConfigBuilder withRoutingTablePurgeDelay (long delay , TimeUnit unit ) {
@@ -476,15 +490,16 @@ public ConfigBuilder withRoutingTablePurgeDelay(long delay, TimeUnit unit) {
476
490
/**
477
491
* Specify how many records to fetch in each batch.
478
492
* This config is only valid when the driver is used with servers that support Bolt V4 (Server version 4.0 and later).
479
- *
493
+ * <p>
480
494
* Bolt V4 enables pulling records in batches to allow client to take control of data population and apply back pressure to server.
481
495
* This config specifies the default fetch size for all query runs using {@link Session} and {@link org.neo4j.driver.async.AsyncSession}.
482
496
* By default, the value is set to {@code 1000}.
483
497
* Use {@code -1} to disables back pressure and config client to pull all records at once after each run.
484
- *
498
+ * <p>
485
499
* This config only applies to run result obtained via {@link Session} and {@link org.neo4j.driver.async.AsyncSession}.
486
500
* As with {@link org.neo4j.driver.reactive.RxSession}, the batch size is provided via
487
501
* {@link org.reactivestreams.Subscription#request(long)} instead.
502
+ *
488
503
* @param size the default record fetch size when pulling records in batches using Bolt V4.
489
504
* @return this builder
490
505
*/
@@ -505,10 +520,10 @@ public ConfigBuilder withFetchSize(long size) {
505
520
* The default value of this parameter is {@code 30 SECONDS}.
506
521
*
507
522
* @param value the timeout duration
508
- * @param unit the unit in which duration is given
523
+ * @param unit the unit in which duration is given
509
524
* @return this builder
510
525
* @throws IllegalArgumentException when given value is negative or does not fit in {@code int} when
511
- * converted to milliseconds.
526
+ * converted to milliseconds.
512
527
*/
513
528
public ConfigBuilder withConnectionTimeout (long value , TimeUnit unit ) {
514
529
long connectionTimeoutMillis = unit .toMillis (value );
@@ -527,16 +542,14 @@ public ConfigBuilder withConnectionTimeout(long value, TimeUnit unit) {
527
542
}
528
543
529
544
/**
530
- * Specify the maximum time transactions are allowed to retry via
531
- * {@link Session#readTransaction(TransactionWork)} and {@link Session#writeTransaction(TransactionWork)}
532
- * methods. These methods will retry the given unit of work on {@link org.neo4j.driver.exceptions.ServiceUnavailableException},
533
- * {@link org.neo4j.driver.exceptions.SessionExpiredException} and {@link org.neo4j.driver.exceptions.TransientException} with
534
- * exponential backoff using initial delay of 1 second.
545
+ * Specify the maximum time managed transactions are allowed to retry.
546
+ * <p>
547
+ * Managed transactions are available via methods like {@link Session#executeRead(TransactionCallback)}, {@link Session#executeWrite(TransactionCallback, TransactionConfig)} and some other variations available under similar naming.
535
548
* <p>
536
549
* Default value is 30 seconds.
537
550
*
538
551
* @param value the timeout duration
539
- * @param unit the unit in which duration is given
552
+ * @param unit the unit in which duration is given
540
553
* @return this builder
541
554
* @throws IllegalArgumentException when given value is negative
542
555
*/
@@ -546,7 +559,7 @@ public ConfigBuilder withMaxTransactionRetryTime(long value, TimeUnit unit) {
546
559
throw new IllegalArgumentException (
547
560
String .format ("The max retry time may not be smaller than 0, but was %d %s." , value , unit ));
548
561
}
549
- this .maxTransactionRetryTime = maxRetryTimeMs ;
562
+ this .maxTransactionRetryTimeMillis = maxRetryTimeMs ;
550
563
return this ;
551
564
}
552
565
@@ -579,6 +592,7 @@ public ConfigBuilder withDriverMetrics() {
579
592
580
593
/**
581
594
* Disable driver metrics. When disabled, driver metrics cannot be accessed via {@link Driver#metrics()}.
595
+ *
582
596
* @return this builder.
583
597
*/
584
598
public ConfigBuilder withoutDriverMetrics () {
@@ -612,6 +626,7 @@ public ConfigBuilder withMetricsAdapter(MetricsAdapter metricsAdapter) {
612
626
/**
613
627
* Configure the event loop thread count. This specifies how many threads the driver can use to handle network I/O events
614
628
* and user's events in driver's I/O threads. By default, 2 * NumberOfProcessors amount of threads will be used instead.
629
+ *
615
630
* @param size the thread count.
616
631
* @return this builder.
617
632
* @throws IllegalArgumentException if the value of the size is set to a number that is less than 1.
@@ -627,6 +642,7 @@ public ConfigBuilder withEventLoopThreads(int size) {
627
642
628
643
/**
629
644
* Configure the user_agent field sent to the server to identify the connected client.
645
+ *
630
646
* @param userAgent the string to configure user_agent.
631
647
* @return this builder.
632
648
*/
@@ -795,6 +811,7 @@ public static TrustStrategy trustAllCertificates() {
795
811
796
812
/**
797
813
* The revocation strategy used for verifying certificates.
814
+ *
798
815
* @return this {@link TrustStrategy}'s revocation strategy
799
816
*/
800
817
public RevocationCheckingStrategy revocationCheckingStrategy () {
@@ -804,6 +821,7 @@ public RevocationCheckingStrategy revocationCheckingStrategy() {
804
821
/**
805
822
* Configures the {@link TrustStrategy} to not carry out OCSP revocation checks on certificates. This is the
806
823
* option that is configured by default.
824
+ *
807
825
* @return the current trust strategy
808
826
*/
809
827
public TrustStrategy withoutCertificateRevocationChecks () {
@@ -816,6 +834,7 @@ public TrustStrategy withoutCertificateRevocationChecks() {
816
834
* stapled to the certificate. If no stapled response is found, then certificate verification continues
817
835
* (and does not fail verification). This setting also requires the server to be configured to enable
818
836
* OCSP stapling.
837
+ *
819
838
* @return the current trust strategy
820
839
*/
821
840
public TrustStrategy withVerifyIfPresentRevocationChecks () {
@@ -827,9 +846,10 @@ public TrustStrategy withVerifyIfPresentRevocationChecks() {
827
846
* Configures the {@link TrustStrategy} to carry out strict OCSP revocation checks for revocation status that
828
847
* are stapled to the certificate. If no stapled response is found, then the driver will fail certificate verification
829
848
* and not connect to the server. This setting also requires the server to be configured to enable OCSP stapling.
830
- *
849
+ * <p>
831
850
* Note: enabling this setting will prevent the driver connecting to the server when the server is unable to reach
832
851
* the certificate's configured OCSP responder URL.
852
+ *
833
853
* @return the current trust strategy
834
854
*/
835
855
public TrustStrategy withStrictRevocationChecks () {
0 commit comments