From 6b1bcac7ea3a8db8fc12b64566042a609e5829b1 Mon Sep 17 00:00:00 2001
From: Valentin Kovalenko
Date: Fri, 2 Feb 2024 15:08:23 -0700
Subject: [PATCH 1/2] Do minor improvements to method docs in `ClusterSettings`
---
.../mongodb/connection/ClusterSettings.java | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/driver-core/src/main/com/mongodb/connection/ClusterSettings.java b/driver-core/src/main/com/mongodb/connection/ClusterSettings.java
index 4bf1b47c6c0..267e1230d71 100644
--- a/driver-core/src/main/com/mongodb/connection/ClusterSettings.java
+++ b/driver-core/src/main/com/mongodb/connection/ClusterSettings.java
@@ -151,10 +151,12 @@ public Builder srvHost(final String srvHost) {
/**
* Sets the maximum number of hosts to connect to when using SRV protocol.
+ * This setting is not used if {@link #getMode()} is {@link ClusterConnectionMode#LOAD_BALANCED}.
*
* @param srvMaxHosts the maximum number of hosts to connect to when using SRV protocol
* @return this
* @since 4.4
+ * @see #getSrvMaxHosts()
*/
public Builder srvMaxHosts(final Integer srvMaxHosts) {
this.srvMaxHosts = srvMaxHosts;
@@ -168,8 +170,8 @@ public Builder srvMaxHosts(final Integer srvMaxHosts) {
* The SRV resource record (RFC 2782)
* service name, which is limited to 15 characters
* (RFC 6335 section 5.1).
- * If specified, it is combined with the single host name specified by
- * {@link #getHosts()} as follows: {@code _srvServiceName._tcp.hostName}. The combined string is an SRV resource record
+ * If specified, it is combined with the host name specified by
+ * {@link #getSrvHost()} as follows: {@code _srvServiceName._tcp.hostName}. The combined string is an SRV resource record
* name (RFC 1035 section 2.3.1), which is limited to 255
* characters (RFC 1035 section 2.3.4).
*
@@ -177,6 +179,7 @@ public Builder srvMaxHosts(final Integer srvMaxHosts) {
* @param srvServiceName the SRV service name
* @return this
* @since 4.5
+ * @see #getSrvServiceName()
*/
public Builder srvServiceName(final String srvServiceName) {
this.srvServiceName = notNull("srvServiceName", srvServiceName);
@@ -219,6 +222,7 @@ public Builder mode(final ClusterConnectionMode mode) {
/**
* Sets the required replica set name for the cluster.
+ * This setting is not used if {@link #getMode()} is {@link ClusterConnectionMode#LOAD_BALANCED}.
*
* @param requiredReplicaSetName the required replica set name.
* @return this
@@ -231,9 +235,11 @@ public Builder requiredReplicaSetName(@Nullable final String requiredReplicaSetN
/**
* Sets the required cluster type for the cluster.
+ * This setting is not used if {@link #getMode()} is {@link ClusterConnectionMode#LOAD_BALANCED}.
*
* @param requiredClusterType the required cluster type
* @return this
+ * @see #getRequiredClusterType()
*/
public Builder requiredClusterType(final ClusterType requiredClusterType) {
this.requiredClusterType = notNull("requiredClusterType", requiredClusterType);
@@ -384,9 +390,11 @@ public String getSrvHost() {
/**
* Gets the maximum number of hosts to connect to when using SRV protocol.
+ * This setting is not used if {@link #getMode()} is {@link ClusterConnectionMode#LOAD_BALANCED}.
*
* @return the maximum number of hosts to connect to when using SRV protocol. Defaults to null.
* @since 4.4
+ * @see Builder#srvMaxHosts(Integer)
*/
@Nullable
public Integer getSrvMaxHosts() {
@@ -400,14 +408,15 @@ public Integer getSrvMaxHosts() {
* The SRV resource record (RFC 2782)
* service name, which is limited to 15 characters
* (RFC 6335 section 5.1).
- * If specified, it is combined with the single host name specified by
- * {@link #getHosts()} as follows: {@code _srvServiceName._tcp.hostName}. The combined string is an SRV resource record
+ * If specified, it is combined with the host name specified by
+ * {@link #getSrvHost()} as follows: {@code _srvServiceName._tcp.hostName}. The combined string is an SRV resource record
* name (RFC 1035 section 2.3.1), which is limited to 255
* characters (RFC 1035 section 2.3.4).
*
*
* @return the SRV service name, which defaults to {@code "mongodb"}
* @since 4.5
+ * @see Builder#srvServiceName(String)
*/
public String getSrvServiceName() {
return srvServiceName;
@@ -433,8 +442,10 @@ public ClusterConnectionMode getMode() {
/**
* Gets the required cluster type
+ * This setting is not used if {@link #getMode()} is {@link ClusterConnectionMode#LOAD_BALANCED}.
*
* @return the required cluster type
+ * @see Builder#requiredClusterType(ClusterType)
*/
public ClusterType getRequiredClusterType() {
return requiredClusterType;
@@ -442,6 +453,7 @@ public ClusterType getRequiredClusterType() {
/**
* Gets the required replica set name.
+ * This setting is not used if {@link #getMode()} is {@link ClusterConnectionMode#LOAD_BALANCED}.
*
* @return the required replica set name
* @see Builder#requiredReplicaSetName(String)
From 5a38642dfa718f0c99516565639b6364d6b83ca7 Mon Sep 17 00:00:00 2001
From: Valentin Kovalenko
Date: Fri, 2 Feb 2024 15:24:05 -0700
Subject: [PATCH 2/2] One more small improvement
---
.../src/main/com/mongodb/connection/ClusterSettings.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/driver-core/src/main/com/mongodb/connection/ClusterSettings.java b/driver-core/src/main/com/mongodb/connection/ClusterSettings.java
index 267e1230d71..84a24bbd22b 100644
--- a/driver-core/src/main/com/mongodb/connection/ClusterSettings.java
+++ b/driver-core/src/main/com/mongodb/connection/ClusterSettings.java
@@ -170,7 +170,7 @@ public Builder srvMaxHosts(final Integer srvMaxHosts) {
* The SRV resource record (RFC 2782)
* service name, which is limited to 15 characters
* (RFC 6335 section 5.1).
- * If specified, it is combined with the host name specified by
+ * It is combined with the host name specified by
* {@link #getSrvHost()} as follows: {@code _srvServiceName._tcp.hostName}. The combined string is an SRV resource record
* name (RFC 1035 section 2.3.1), which is limited to 255
* characters (RFC 1035 section 2.3.4).
@@ -408,7 +408,7 @@ public Integer getSrvMaxHosts() {
* The SRV resource record (RFC 2782)
* service name, which is limited to 15 characters
* (RFC 6335 section 5.1).
- * If specified, it is combined with the host name specified by
+ * It is combined with the host name specified by
* {@link #getSrvHost()} as follows: {@code _srvServiceName._tcp.hostName}. The combined string is an SRV resource record
* name (RFC 1035 section 2.3.1), which is limited to 255
* characters (RFC 1035 section 2.3.4).