Skip to content

Commit 2e24eb6

Browse files
authored
Add Javadoc to specify that CSOT does not limit socket writes (#1791)
JAVA-5569
1 parent 2215413 commit 2e24eb6

12 files changed

Lines changed: 92 additions & 6 deletions

File tree

driver-core/src/main/com/mongodb/ClientEncryptionSettings.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,15 @@ public Builder keyExpiration(@Nullable final Long keyExpiration, final TimeUnit
172172
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
173173
* </ul>
174174
*
175-
* <p><strong>Note:</strong> The timeout set through this method overrides the timeout defined in the key vault client settings
176-
* specified in {@link #keyVaultMongoClientSettings(MongoClientSettings)}.
177-
* Essentially, for operations that require accessing the key vault, the remaining timeout from the initial operation
178-
* determines the duration allowed for key vault access.</p>
175+
* <p>Note:
176+
* <ul>
177+
* <li>The timeout set through this method overrides the timeout defined in the key vault client settings
178+
* specified in {@link #keyVaultMongoClientSettings(MongoClientSettings)}.
179+
* Essentially, for operations that require accessing the key vault, the remaining timeout from the initial operation
180+
* determines the duration allowed for key vault access.</li>
181+
* <li>When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
182+
* operation might not be timed out when expected. This limitation does not apply to the reactive streams API.</li>
183+
* </ul>
179184
*
180185
* @param timeout the timeout
181186
* @param timeUnit the time unit
@@ -368,6 +373,16 @@ public Long getKeyExpiration(final TimeUnit timeUnit) {
368373
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
369374
* </ul>
370375
*
376+
* <p>Note:
377+
* <ul>
378+
* <li>The timeout set through this method overrides the timeout defined in the key vault client settings
379+
* specified in {@link Builder#keyVaultMongoClientSettings(MongoClientSettings)}.
380+
* Essentially, for operations that require accessing the key vault, the remaining timeout from the initial operation
381+
* determines the duration allowed for key vault access.</li>
382+
* <li>When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
383+
* operation might not be timed out when expected. This limitation does not apply to the reactive streams API.</li>
384+
* </ul>
385+
*
371386
* @param timeUnit the time unit
372387
* @return the timeout in the given time unit
373388
* @since 5.2

driver-core/src/main/com/mongodb/ClientSessionOptions.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public TransactionOptions getDefaultTransactionOptions() {
9292
* <li>{@code withTransaction}</li>
9393
* <li>{@code close}</li>
9494
* </ul>
95+
*
96+
* <p>Note: When using synchronous API, this timeout does not limit socket writes, therefore
97+
* there is a possibility that the operation might not be timed out when expected. This limitation does not
98+
* apply to the reactive streams API.
99+
*
95100
* @param timeUnit the time unit
96101
* @return the default timeout
97102
* @since 5.2
@@ -220,6 +225,11 @@ public Builder defaultTransactionOptions(final TransactionOptions defaultTransac
220225
* <li>{@code withTransaction}</li>
221226
* <li>{@code close}</li>
222227
* </ul>
228+
*
229+
* <p>Note: When using synchronous API, this timeout does not limit socket writes, therefore
230+
* there is a possibility that the operation might not be timed out when expected. This limitation does not
231+
* apply to the reactive streams API.
232+
*
223233
* @param defaultTimeout the timeout
224234
* @param timeUnit the time unit
225235
* @return this

driver-core/src/main/com/mongodb/MongoClientSettings.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,9 @@ public Builder inetAddressResolver(@Nullable final InetAddressResolver inetAddre
716716
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
717717
* </ul>
718718
*
719+
* <p>Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
720+
* operation might not be timed out when expected. This limitation does not apply to the reactive streams API.
721+
*
719722
* @param timeout the timeout
720723
* @param timeUnit the time unit
721724
* @return this
@@ -931,6 +934,9 @@ public ServerApi getServerApi() {
931934
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
932935
* </ul>
933936
*
937+
* <p>Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
938+
* operation might not be timed out when expected. This limitation does not apply to the reactive streams API.
939+
*
934940
* @param timeUnit the time unit
935941
* @return the timeout in the given time unit
936942
* @since 5.2

driver-core/src/main/com/mongodb/TransactionOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ public Long getMaxCommitTime(final TimeUnit timeUnit) {
109109
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
110110
* </ul>
111111
*
112+
* <p>Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
113+
* operation might not be timed out when expected. This limitation does not apply to the reactive streams API.
114+
*
112115
* @param timeUnit the time unit
113116
* @return the timeout in the given time unit
114117
* @since 5.2
@@ -292,6 +295,9 @@ public Builder maxCommitTime(@Nullable final Long maxCommitTime, final TimeUnit
292295
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
293296
* </ul>
294297
*
298+
* <p>Note: When using synchronous API, this timeout does not limit socket writes, therefore there is a possibility that the
299+
* operation might not be timed out when expected. This limitation does not apply to the reactive streams API.
300+
*
295301
* @param timeout the timeout
296302
* @param timeUnit the time unit
297303
* @return this

driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCluster.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo
7878
* - `0` means infinite timeout.
7979
* - `> 0` The time limit to use for the full execution of an operation.
8080
*
81+
* Note: This timeout does not limit socket writes, therefore there is a possibility that the operation might not be
82+
* timed out when expected.
83+
*
8184
* @return the optional timeout duration
85+
* @since 5.2
8286
*/
8387
@Alpha(Reason.CLIENT)
8488
public fun timeout(timeUnit: TimeUnit = TimeUnit.MILLISECONDS): Long? = wrapped.getTimeout(timeUnit)
@@ -131,6 +135,9 @@ public open class MongoCluster protected constructor(private val wrapped: JMongo
131135
* - `0` means an infinite timeout
132136
* - `> 0` The time limit to use for the full execution of an operation.
133137
*
138+
* Note: This timeout does not limit socket writes, therefore there is a possibility that the operation might not be
139+
* timed out when expected.
140+
*
134141
* @param timeout the timeout, which must be greater than or equal to 0
135142
* @param timeUnit the time unit, defaults to Milliseconds
136143
* @return a new MongoCluster instance with the set time limit for operations

driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoCollection.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ public class MongoCollection<T : Any>(private val wrapped: JMongoCollection<T>)
102102
* - `0` means infinite timeout.
103103
* - `> 0` The time limit to use for the full execution of an operation.
104104
*
105+
* Note: This timeout does not limit socket writes, therefore there is a possibility that the operation might not be
106+
* timed out when expected.
107+
*
105108
* @return the optional timeout duration
106109
* @since 5.2
107110
*/
@@ -176,6 +179,9 @@ public class MongoCollection<T : Any>(private val wrapped: JMongoCollection<T>)
176179
* - `0` means an infinite timeout
177180
* - `> 0` The time limit to use for the full execution of an operation.
178181
*
182+
* Note: This timeout does not limit socket writes, therefore there is a possibility that the operation might not be
183+
* timed out when expected.
184+
*
179185
* @param timeout the timeout, which must be greater than or equal to 0
180186
* @param timeUnit the time unit, defaults to Milliseconds
181187
* @return a new MongoCollection instance with the set time limit for operations

driver-kotlin-sync/src/main/kotlin/com/mongodb/kotlin/client/MongoDatabase.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
7171
* - `0` means infinite timeout.
7272
* - `> 0` The time limit to use for the full execution of an operation.
7373
*
74+
* Note: This timeout does not limit socket writes, therefore there is a possibility that the operation might not be
75+
* timed out when expected.
76+
*
7477
* @return the optional timeout duration
7578
* @since 5.2
7679
*/
@@ -125,6 +128,9 @@ public class MongoDatabase(private val wrapped: JMongoDatabase) {
125128
* - `0` means an infinite timeout
126129
* - `> 0` The time limit to use for the full execution of an operation.
127130
*
131+
* Note: This timeout does not limit socket writes, therefore there is a possibility that the operation might not be
132+
* timed out when expected.
133+
*
128134
* @param timeout the timeout, which must be greater than or equal to 0
129135
* @param timeUnit the time unit, defaults to Milliseconds
130136
* @return a new MongoDatabase instance with the set time limit for operations

driver-legacy/src/main/com/mongodb/MongoClientOptions.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,9 @@ public ServerApi getServerApi() {
575575
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
576576
* </ul>
577577
*
578+
* <p>Note that this timeout does not limit socket writes, therefore there is a possibility that the
579+
* operation might not be timed out when expected.
580+
*
578581
* @return the timeout in milliseconds
579582
* @since 5.2
580583
*/
@@ -1370,6 +1373,9 @@ public Builder srvServiceName(final String srvServiceName) {
13701373
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
13711374
* </ul>
13721375
*
1376+
* <p>Note that this timeout does not limit socket writes, therefore there is a possibility that the
1377+
* operation might not be timed out when expected.
1378+
*
13731379
* @param timeoutMS the timeout in milliseconds
13741380
* @return this
13751381
* @since 5.2

driver-sync/src/main/com/mongodb/client/MongoCluster.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ public interface MongoCluster {
110110
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
111111
* </ul>
112112
*
113+
* <p>Note: This timeout does not limit socket writes, therefore there is a possibility that the
114+
* operation might not be timed out when expected.
115+
*
113116
* @param timeUnit the time unit
114117
* @return the timeout in the given time unit
115118
* @since 5.2
@@ -169,6 +172,9 @@ public interface MongoCluster {
169172
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
170173
* </ul>
171174
*
175+
* <p>Note: This timeout does not limit socket writes, therefore there is a possibility that the
176+
* operation might not be timed out when expected.
177+
*
172178
* @param timeout the timeout, which must be greater than or equal to 0
173179
* @param timeUnit the time unit
174180
* @return a new MongoCluster instance with the set time limit for the full execution of an operation.

driver-sync/src/main/com/mongodb/client/MongoCollection.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ public interface MongoCollection<TDocument> {
138138
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
139139
* </ul>
140140
*
141+
* <p>Note: This timeout does not limit socket writes, therefore there is a possibility that the
142+
* operation might not be timed out when expected.
143+
*
141144
* @param timeUnit the time unit
142145
* @return the timeout in the given time unit
143146
* @since 5.2
@@ -204,6 +207,9 @@ public interface MongoCollection<TDocument> {
204207
* <li>{@code > 0} The time limit to use for the full execution of an operation.</li>
205208
* </ul>
206209
*
210+
* <p>Note: This timeout does not limit socket writes, therefore there is a possibility that the
211+
* operation might not be timed out when expected.
212+
*
207213
* @param timeout the timeout, which must be greater than or equal to 0
208214
* @param timeUnit the time unit
209215
* @return a new MongoCollection instance with the set time limit for the full execution of an operation

0 commit comments

Comments
 (0)