You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/connection/specify-connection-options/connection-pools.txt
+66-13Lines changed: 66 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -114,22 +114,75 @@ see the corresponding syntax:
114
114
115
115
*Default*: ``120000`` (120 seconds)
116
116
117
-
To learn more about connection string options, see the
118
-
:ref:`Connection Options <connection-options>`
119
-
guide.
120
-
121
117
.. tab:: MongoClientSettings
122
-
:tabid: MongoClient
118
+
:tabid: MongoClient
119
+
120
+
Chain the `applyToConnectionPoolSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToConnectionPoolSettings(com.mongodb.Block)>`__ method to modify the way the driver manages its connection pool.
121
+
122
+
The following table describes the methods you can chain to your settings to modify the driver's behavior:
123
+
124
+
.. list-table::
125
+
:widths: 40 60
126
+
:header-rows: 1
127
+
128
+
* - Method
129
+
- Description
130
+
131
+
* - ``addConnectionPoolListener()``
132
+
- Adds a listener for connection pool-related events.
133
+
134
+
* - ``applyConnectionString()``
135
+
- Uses the settings from a ``ConnectionString`` object.
136
+
137
+
* - ``applySettings()``
138
+
- Uses the connection pool settings specified in a
139
+
``ConnectionPoolSettings`` object.
140
+
141
+
* - ``maintenanceFrequency()``
142
+
- Sets the frequency for running a maintenance job.
143
+
144
+
* - ``maintenanceInitialDelay()``
145
+
- Sets the time to wait before running the first maintenance job.
146
+
147
+
* - ``maxConnectionIdleTime()``
148
+
- Sets the maximum time a connection can be idle before it's closed.
149
+
150
+
* - ``maxConnectionLifeTime()``
151
+
- Sets the maximum time a pooled connection can be alive before it's
152
+
closed.
153
+
154
+
* - ``maxSize()``
155
+
- | Sets the maximum number of connections associated with a connection
156
+
pool.
157
+
|
158
+
| **Default**: ``100``
159
+
160
+
* - ``maxWaitTime()``
161
+
- | Sets the maximum time to wait for an available connection.
162
+
|
163
+
| **Default**: ``2 minutes``
164
+
165
+
* - ``minSize()``
166
+
- | Sets the minimum number of connections associated with a connection
167
+
pool.
168
+
|
169
+
| **Default**: ``0``
170
+
171
+
.. note::
172
+
173
+
This ``maxSize`` and ``minSize`` settings apply to each server in the cluster you connect the driver to.
174
+
175
+
For example, assume you connect the driver to a cluster with three``mongos`` servers. This means that there can be at most ``maxSize`` connections and at least ``minSize`` connections to each ``mongos`` server.
Copy file name to clipboardExpand all lines: source/connection/specify-connection-options/mongoclientsettings.txt
+48-48Lines changed: 48 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -73,9 +73,9 @@ connection behavior:
73
73
- Applies the ``ClusterSettings.Builder`` block and then sets the
74
74
:ref:`cluster settings <mcs-cluster-settings>`.
75
75
76
-
* - ``applyToConnectionPoolSettings()``
77
-
- Applies the ``ConnectionPoolSettings.Builder`` block and then sets the
78
-
:ref:`connection pool settings <mcs-connectionpool-settings>`.
76
+
.. * - ``applyToConnectionPoolSettings()``
77
+
.. - Applies the ``ConnectionPoolSettings.Builder`` block and then sets the
78
+
.. :ref:`connection pool settings <mcs-connectionpool-settings>`.
79
79
80
80
* - ``applyToLoggerSettings()``
81
81
- Applies the ``LoggerSettings.Builder`` block and then sets the
@@ -308,68 +308,68 @@ regardless of the type of MongoDB cluster it's a part of:
308
308
Connection Pool Settings
309
309
------------------------
310
310
311
-
Chain the `applyToConnectionPoolSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToConnectionPoolSettings(com.mongodb.Block)>`__
312
-
method to modify the way the driver manages its connection pool.
311
+
.. Chain the `applyToConnectionPoolSettings() <{+api+}/apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyToConnectionPoolSettings(com.mongodb.Block)>`__
312
+
.. method to modify the way the driver manages its connection pool.
313
313
314
-
The following table describes the methods you can chain to your
315
-
settings to modify the driver's behavior:
314
+
.. The following table describes the methods you can chain to your
315
+
.. settings to modify the driver's behavior:
316
316
317
-
.. list-table::
318
-
:widths: 40 60
319
-
:header-rows: 1
317
+
.. .. list-table::
318
+
.. :widths: 40 60
319
+
.. :header-rows: 1
320
320
321
-
* - Method
322
-
- Description
321
+
.. * - Method
322
+
.. - Description
323
323
324
-
* - ``addConnectionPoolListener()``
325
-
- Adds a listener for connection pool-related events.
324
+
.. * - ``addConnectionPoolListener()``
325
+
.. - Adds a listener for connection pool-related events.
326
326
327
-
* - ``applyConnectionString()``
328
-
- Uses the settings from a ``ConnectionString`` object.
327
+
.. * - ``applyConnectionString()``
328
+
.. - Uses the settings from a ``ConnectionString`` object.
329
329
330
-
* - ``applySettings()``
331
-
- Uses the connection pool settings specified in a
332
-
``ConnectionPoolSettings`` object.
330
+
.. * - ``applySettings()``
331
+
.. - Uses the connection pool settings specified in a
332
+
.. ``ConnectionPoolSettings`` object.
333
333
334
-
* - ``maintenanceFrequency()``
335
-
- Sets the frequency for running a maintenance job.
334
+
.. * - ``maintenanceFrequency()``
335
+
.. - Sets the frequency for running a maintenance job.
336
336
337
-
* - ``maintenanceInitialDelay()``
338
-
- Sets the time to wait before running the first maintenance job.
337
+
.. * - ``maintenanceInitialDelay()``
338
+
.. - Sets the time to wait before running the first maintenance job.
339
339
340
-
* - ``maxConnectionIdleTime()``
341
-
- Sets the maximum time a connection can be idle before it's closed.
340
+
.. * - ``maxConnectionIdleTime()``
341
+
.. - Sets the maximum time a connection can be idle before it's closed.
342
342
343
-
* - ``maxConnectionLifeTime()``
344
-
- Sets the maximum time a pooled connection can be alive before it's
345
-
closed.
343
+
.. * - ``maxConnectionLifeTime()``
344
+
.. - Sets the maximum time a pooled connection can be alive before it's
345
+
.. closed.
346
346
347
-
* - ``maxSize()``
348
-
- | Sets the maximum number of connections associated with a connection
349
-
pool.
350
-
|
351
-
| **Default**: ``100``
347
+
.. * - ``maxSize()``
348
+
.. - | Sets the maximum number of connections associated with a connection
349
+
.. pool.
350
+
.. |
351
+
.. | **Default**: ``100``
352
352
353
-
* - ``maxWaitTime()``
354
-
- | Sets the maximum time to wait for an available connection.
355
-
|
356
-
| **Default**: ``2 minutes``
353
+
.. * - ``maxWaitTime()``
354
+
.. - | Sets the maximum time to wait for an available connection.
355
+
.. |
356
+
.. | **Default**: ``2 minutes``
357
357
358
-
* - ``minSize()``
359
-
- | Sets the minimum number of connections associated with a connection
360
-
pool.
361
-
|
362
-
| **Default**: ``0``
358
+
.. * - ``minSize()``
359
+
.. - | Sets the minimum number of connections associated with a connection
360
+
.. pool.
361
+
.. |
362
+
.. | **Default**: ``0``
363
363
364
364
365
-
.. note::
365
+
.. .. note::
366
366
367
-
This ``maxSize`` and ``minSize`` settings apply to each server
368
-
in the cluster you connect the driver to.
367
+
.. This ``maxSize`` and ``minSize`` settings apply to each server
368
+
.. in the cluster you connect the driver to.
369
369
370
-
For example, assume you connect the driver to a cluster with three
371
-
``mongos`` servers. This means that there can be at most ``maxSize``
372
-
connections and at least ``minSize`` connections to each ``mongos`` server.
370
+
.. For example, assume you connect the driver to a cluster with three
371
+
.. ``mongos`` servers. This means that there can be at most ``maxSize``
372
+
.. connections and at least ``minSize`` connections to each ``mongos`` server.
0 commit comments