3636import org .neo4j .driver .internal .async .pool .PoolSettings ;
3737import org .neo4j .driver .internal .cluster .RoutingSettings ;
3838import org .neo4j .driver .internal .handlers .pulln .FetchSizeUtil ;
39- import org .neo4j .driver .internal .retry .RetrySettings ;
39+ import org .neo4j .driver .internal .retry .ExponentialBackoffRetryLogic ;
4040import org .neo4j .driver .net .ServerAddressResolver ;
4141import org .neo4j .driver .util .Experimental ;
4242import org .neo4j .driver .util .Immutable ;
@@ -75,7 +75,9 @@ public final class Config implements Serializable {
7575
7676 private static final Config EMPTY = builder ().build ();
7777
78- /** User defined logging */
78+ /**
79+ * User defined logging
80+ */
7981 private final Logging logging ;
8082
8183 private final boolean logLeakedSessions ;
@@ -90,9 +92,9 @@ public final class Config implements Serializable {
9092
9193 private final long fetchSize ;
9294 private final long routingTablePurgeDelayMillis ;
95+ private final long maxTransactionRetryTimeMillis ;
9396
9497 private final int connectionTimeoutMillis ;
95- private final RetrySettings retrySettings ;
9698 private final ServerAddressResolver resolver ;
9799
98100 private final int eventLoopThreads ;
@@ -113,7 +115,7 @@ private Config(ConfigBuilder builder) {
113115
114116 this .connectionTimeoutMillis = builder .connectionTimeoutMillis ;
115117 this .routingTablePurgeDelayMillis = builder .routingTablePurgeDelayMillis ;
116- this .retrySettings = builder .retrySettings ;
118+ this .maxTransactionRetryTimeMillis = builder .maxTransactionRetryTimeMillis ;
117119 this .resolver = builder .resolver ;
118120 this .fetchSize = builder .fetchSize ;
119121
@@ -123,6 +125,7 @@ private Config(ConfigBuilder builder) {
123125
124126 /**
125127 * Logging provider
128+ *
126129 * @return the Logging provider to use
127130 */
128131 public Logging logging () {
@@ -212,18 +215,21 @@ public static Config defaultConfig() {
212215 }
213216
214217 /**
215- * @return the security setting to use when creating connections.
218+ * Returns stale routing table purge delay.
219+ *
220+ * @return routing table purge delay
216221 */
217- SecuritySettings securitySettings () {
218- return securitySettings ;
222+ public long routingTablePurgeDelayMillis () {
223+ return routingTablePurgeDelayMillis ;
219224 }
220225
221- RoutingSettings routingSettings () {
222- return new RoutingSettings (routingTablePurgeDelayMillis );
223- }
224-
225- RetrySettings retrySettings () {
226- return retrySettings ;
226+ /**
227+ * Returns managed transactions maximum retry time.
228+ *
229+ * @return maximum retry time
230+ */
231+ public long maxTransactionRetryTimeMillis () {
232+ return maxTransactionRetryTimeMillis ;
227233 }
228234
229235 public long fetchSize () {
@@ -265,9 +271,9 @@ public static final class ConfigBuilder {
265271 private String userAgent = format ("neo4j-java/%s" , driverVersion ());
266272 private final SecuritySettings .SecuritySettingsBuilder securitySettingsBuilder =
267273 new SecuritySettings .SecuritySettingsBuilder ();
268- private long routingTablePurgeDelayMillis = RoutingSettings .DEFAULT . routingTablePurgeDelayMs () ;
274+ private long routingTablePurgeDelayMillis = RoutingSettings .STALE_ROUTING_TABLE_PURGE_DELAY_MS ;
269275 private int connectionTimeoutMillis = (int ) TimeUnit .SECONDS .toMillis (30 );
270- private RetrySettings retrySettings = RetrySettings . DEFAULT ;
276+ private long maxTransactionRetryTimeMillis = ExponentialBackoffRetryLogic . DEFAULT_MAX_RETRY_TIME_MS ;
271277 private ServerAddressResolver resolver ;
272278 private MetricsAdapter metricsAdapter = MetricsAdapter .DEV_NULL ;
273279 private long fetchSize = FetchSizeUtil .DEFAULT_FETCH_SIZE ;
@@ -331,7 +337,7 @@ public ConfigBuilder withLeakedSessionsLogging() {
331337 * validity and negative values mean connections will never be tested.
332338 *
333339 * @param value the minimum idle time
334- * @param unit the unit in which the duration is given
340+ * @param unit the unit in which the duration is given
335341 * @return this builder
336342 */
337343 public ConfigBuilder withConnectionLivenessCheckTimeout (long value , TimeUnit unit ) {
@@ -356,7 +362,7 @@ public ConfigBuilder withConnectionLivenessCheckTimeout(long value, TimeUnit uni
356362 * checked.
357363 *
358364 * @param value the maximum connection lifetime
359- * @param unit the unit in which the duration is given
365+ * @param unit the unit in which the duration is given
360366 * @return this builder
361367 */
362368 public ConfigBuilder withMaxConnectionLifetime (long value , TimeUnit unit ) {
@@ -402,7 +408,7 @@ public ConfigBuilder withMaxConnectionPoolSize(int value) {
402408 * of {@code 0} is allowed and results in no timeout and immediate failure when connection is unavailable.
403409 *
404410 * @param value the acquisition timeout
405- * @param unit the unit in which the duration is given
411+ * @param unit the unit in which the duration is given
406412 * @return this builder
407413 * @see #withMaxConnectionPoolSize(int)
408414 */
@@ -418,6 +424,7 @@ public ConfigBuilder withConnectionAcquisitionTimeout(long value, TimeUnit unit)
418424
419425 /**
420426 * Set to use encrypted traffic.
427+ *
421428 * @return this builder
422429 */
423430 public ConfigBuilder withEncryption () {
@@ -427,6 +434,7 @@ public ConfigBuilder withEncryption() {
427434
428435 /**
429436 * Set to use unencrypted traffic.
437+ *
430438 * @return this builder
431439 */
432440 public ConfigBuilder withoutEncryption () {
@@ -461,13 +469,12 @@ public ConfigBuilder withTrustStrategy(TrustStrategy trustStrategy) {
461469 * The routing table of a database get refreshed if the database is used frequently.
462470 * If the database is not used for a long time,
463471 * the driver use the timeout specified here to purge the stale routing table.
464- *
472+ * <p>
465473 * After a routing table is removed, next time when using the database of the purged routing table,
466474 * the driver will fall back to use seed URI for a new routing table.
467- * @param delay
468- * the amount of time to wait before purging routing tables
469- * @param unit
470- * 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
471478 * @return this builder
472479 */
473480 public ConfigBuilder withRoutingTablePurgeDelay (long delay , TimeUnit unit ) {
@@ -483,15 +490,16 @@ public ConfigBuilder withRoutingTablePurgeDelay(long delay, TimeUnit unit) {
483490 /**
484491 * Specify how many records to fetch in each batch.
485492 * This config is only valid when the driver is used with servers that support Bolt V4 (Server version 4.0 and later).
486- *
493+ * <p>
487494 * Bolt V4 enables pulling records in batches to allow client to take control of data population and apply back pressure to server.
488495 * This config specifies the default fetch size for all query runs using {@link Session} and {@link org.neo4j.driver.async.AsyncSession}.
489496 * By default, the value is set to {@code 1000}.
490497 * Use {@code -1} to disables back pressure and config client to pull all records at once after each run.
491- *
498+ * <p>
492499 * This config only applies to run result obtained via {@link Session} and {@link org.neo4j.driver.async.AsyncSession}.
493500 * As with {@link org.neo4j.driver.reactive.RxSession}, the batch size is provided via
494501 * {@link org.reactivestreams.Subscription#request(long)} instead.
502+ *
495503 * @param size the default record fetch size when pulling records in batches using Bolt V4.
496504 * @return this builder
497505 */
@@ -512,10 +520,10 @@ public ConfigBuilder withFetchSize(long size) {
512520 * The default value of this parameter is {@code 30 SECONDS}.
513521 *
514522 * @param value the timeout duration
515- * @param unit the unit in which duration is given
523+ * @param unit the unit in which duration is given
516524 * @return this builder
517525 * @throws IllegalArgumentException when given value is negative or does not fit in {@code int} when
518- * converted to milliseconds.
526+ * converted to milliseconds.
519527 */
520528 public ConfigBuilder withConnectionTimeout (long value , TimeUnit unit ) {
521529 long connectionTimeoutMillis = unit .toMillis (value );
@@ -534,16 +542,14 @@ public ConfigBuilder withConnectionTimeout(long value, TimeUnit unit) {
534542 }
535543
536544 /**
537- * Specify the maximum time transactions are allowed to retry via
538- * {@link Session#readTransaction(TransactionWork)} and {@link Session#writeTransaction(TransactionWork)}
539- * methods. These methods will retry the given unit of work on {@link org.neo4j.driver.exceptions.ServiceUnavailableException},
540- * {@link org.neo4j.driver.exceptions.SessionExpiredException} and {@link org.neo4j.driver.exceptions.TransientException} with
541- * 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.
542548 * <p>
543549 * Default value is 30 seconds.
544550 *
545551 * @param value the timeout duration
546- * @param unit the unit in which duration is given
552+ * @param unit the unit in which duration is given
547553 * @return this builder
548554 * @throws IllegalArgumentException when given value is negative
549555 */
@@ -553,7 +559,7 @@ public ConfigBuilder withMaxTransactionRetryTime(long value, TimeUnit unit) {
553559 throw new IllegalArgumentException (
554560 String .format ("The max retry time may not be smaller than 0, but was %d %s." , value , unit ));
555561 }
556- this .retrySettings = new RetrySettings ( maxRetryTimeMs ) ;
562+ this .maxTransactionRetryTimeMillis = maxRetryTimeMs ;
557563 return this ;
558564 }
559565
@@ -586,6 +592,7 @@ public ConfigBuilder withDriverMetrics() {
586592
587593 /**
588594 * Disable driver metrics. When disabled, driver metrics cannot be accessed via {@link Driver#metrics()}.
595+ *
589596 * @return this builder.
590597 */
591598 public ConfigBuilder withoutDriverMetrics () {
@@ -619,6 +626,7 @@ public ConfigBuilder withMetricsAdapter(MetricsAdapter metricsAdapter) {
619626 /**
620627 * Configure the event loop thread count. This specifies how many threads the driver can use to handle network I/O events
621628 * and user's events in driver's I/O threads. By default, 2 * NumberOfProcessors amount of threads will be used instead.
629+ *
622630 * @param size the thread count.
623631 * @return this builder.
624632 * @throws IllegalArgumentException if the value of the size is set to a number that is less than 1.
@@ -634,6 +642,7 @@ public ConfigBuilder withEventLoopThreads(int size) {
634642
635643 /**
636644 * Configure the user_agent field sent to the server to identify the connected client.
645+ *
637646 * @param userAgent the string to configure user_agent.
638647 * @return this builder.
639648 */
@@ -802,6 +811,7 @@ public static TrustStrategy trustAllCertificates() {
802811
803812 /**
804813 * The revocation strategy used for verifying certificates.
814+ *
805815 * @return this {@link TrustStrategy}'s revocation strategy
806816 */
807817 public RevocationCheckingStrategy revocationCheckingStrategy () {
@@ -811,6 +821,7 @@ public RevocationCheckingStrategy revocationCheckingStrategy() {
811821 /**
812822 * Configures the {@link TrustStrategy} to not carry out OCSP revocation checks on certificates. This is the
813823 * option that is configured by default.
824+ *
814825 * @return the current trust strategy
815826 */
816827 public TrustStrategy withoutCertificateRevocationChecks () {
@@ -823,6 +834,7 @@ public TrustStrategy withoutCertificateRevocationChecks() {
823834 * stapled to the certificate. If no stapled response is found, then certificate verification continues
824835 * (and does not fail verification). This setting also requires the server to be configured to enable
825836 * OCSP stapling.
837+ *
826838 * @return the current trust strategy
827839 */
828840 public TrustStrategy withVerifyIfPresentRevocationChecks () {
@@ -834,9 +846,10 @@ public TrustStrategy withVerifyIfPresentRevocationChecks() {
834846 * Configures the {@link TrustStrategy} to carry out strict OCSP revocation checks for revocation status that
835847 * are stapled to the certificate. If no stapled response is found, then the driver will fail certificate verification
836848 * and not connect to the server. This setting also requires the server to be configured to enable OCSP stapling.
837- *
849+ * <p>
838850 * Note: enabling this setting will prevent the driver connecting to the server when the server is unable to reach
839851 * the certificate's configured OCSP responder URL.
852+ *
840853 * @return the current trust strategy
841854 */
842855 public TrustStrategy withStrictRevocationChecks () {
0 commit comments