@@ -52,110 +52,105 @@ string or by passing a ``MongoClientSettings`` object to the
52
52
``MongoClients.create()`` method.
53
53
54
54
The following code creates a client with a maximum connection pool size of ``50``
55
- by using either a :guilabel:`Connection String` or :guilabel:` MongoClientSettings`
55
+ by using either a connection String or MongoClientSettings
56
56
object:
57
57
58
58
.. tabs::
59
59
60
- .. tab:: Connection String
61
- :tabid: uri
60
+ .. tab:: Connection String
61
+ :tabid: uri
62
+
63
+ .. code-block:: java
62
64
63
- .. code-block:: java
65
+ ConnectionString connectionString = "mongodb://<host>:<port>/?maxPoolSize=50"
66
+ MongoClient mongoClient = MongoClients.create(connectionString)
64
67
65
- ConnectionString connectionString = "mongodb://<host>:<port>/?maxPoolSize=50"
66
- MongoClient mongoClient = MongoClients.create(connectionString)
68
+ The following are connection string settings you can use to configure your
69
+ connection pool:
67
70
68
- .. tab:: MongoClientSettings
69
- :tabid: MongoClient
70
-
71
- .. literalinclude:: /includes/fundamentals/code-snippets/ConnectionPool.java
72
- :start-after: begin MongoSettings
73
- :end-before: end MongoSettings
74
- :language: java
75
- :dedent:
76
-
77
- Connection Pool Settings
78
- ~~~~~~~~~~~~~~~~~~~~~~~~
71
+ .. list-table::
72
+ :widths: 25,75
73
+ :header-rows: 1
79
74
80
- The following are connection string settings you can use to configure your
81
- connection pool:
75
+ * - Setting
76
+ - Description
77
+
78
+ * - :urioption:`connectTimeoutMS`
82
79
83
- .. list-table::
84
- :widths: 25,75
85
- :header-rows: 1
80
+ - Specifies the maximum amount of time, in milliseconds, the Java driver
81
+ waits for a connection to open before timing out. A value of 0 instructs
82
+ the driver to never time out while waiting for a connection to open.
83
+
84
+ *Default:* ``10000`` (10 seconds)
85
+
86
+ * - :urioption:`maxConnecting`
87
+
88
+ - Maximum number of connections a pool may establish
89
+ concurrently.
86
90
87
- * - Setting
88
- - Description
89
-
90
- * - :urioption:`connectTimeoutMS`
91
+ *Default:* ``2``
92
+
93
+ * - :urioption:`maxIdleTimeMS`
94
+
95
+ - The maximum number of milliseconds that a connection can
96
+ remain idle in the pool before being removed and closed.
91
97
92
- - Specifies the maximum amount of time, in milliseconds, the Java driver
93
- waits for a connection to open before timing out. A value of 0 instructs
94
- the driver to never time out while waiting for a connection to open.
95
-
96
- *Default:* ``10000`` (10 seconds)
97
-
98
- * - :urioption:`maxConnecting`
99
-
100
- - Maximum number of connections a pool may establish
101
- concurrently.
98
+ *Default:* ``0``
99
+
100
+ * - :urioption:`maxPoolSize`
102
101
103
- .. include:: /includes/connection-pool/max-connecting-use-case.rst
102
+ - Maximum number of connections opened in the pool. When the
103
+ connection pool reaches the maximum number of connections, new
104
+ connections wait up until to the value of
105
+ :urioption:`waitQueueTimeoutMS`.
104
106
105
- *Default:* ``2``
106
-
107
- * - :urioption:`maxIdleTimeMS`
108
-
109
- - The maximum number of milliseconds that a connection can
110
- remain idle in the pool before being removed and closed.
107
+ *Default:* ``100``
111
108
112
- *Default:* ``0``
113
-
114
- * - :urioption:`maxPoolSize`
109
+ * - :urioption:`minPoolSize`
115
110
116
- - Maximum number of connections opened in the pool. When the
117
- connection pool reaches the maximum number of connections, new
118
- connections wait up until to the value of
119
- :urioption:`waitQueueTimeoutMS`.
111
+ - Minimum number of connections opened in the pool.
112
+ The value of :urioption:`minPoolSize` must be less than
113
+ the value of :urioption:`maxPoolSize`.
120
114
121
- *Default:* ``100``
115
+ *Default*: ``0``
122
116
123
- * - :urioption:`minPoolSize `
117
+ * - :urioption:`socketTimeoutMS `
124
118
125
- - Minimum number of connections opened in the pool.
126
- The value of :urioption:`minPoolSize` must be less than
127
- the value of :urioption:`maxPoolSize`.
119
+ - Number of milliseconds to wait before timeout on a TCP
120
+ connection.
121
+
122
+ Do *not* use :urioption:`socketTimeoutMS` as a mechanism for
123
+ preventing long-running server operations.
128
124
129
- *Default*: ``0``
125
+ Setting low socket timeouts may result in operations that error
126
+ before the server responds.
127
+
128
+ *Default*: ``0``, which means no timeout.
130
129
131
- * - :urioption:`socketTimeoutMS `
130
+ * - :urioption:`waitQueueTimeoutMS `
132
131
133
- - Number of milliseconds to wait before timeout on a TCP
134
- connection.
135
-
136
- Do *not* use :urioption:`socketTimeoutMS` as a mechanism for
137
- preventing long-running server operations.
132
+ - Maximum wait time in milliseconds that a thread can wait for
133
+ a connection to become available. A value of ``0`` means there
134
+ is no limit.
138
135
139
- Setting low socket timeouts may result in operations that error
140
- before the server responds.
141
-
142
- *Default*: ``0``, which means no timeout.
136
+ *Default*: ``120000`` (120 seconds)
143
137
144
- * - :urioption:`waitQueueTimeoutMS`
138
+ For more information on these connection string options, see the
139
+ :ref:`Connection Options <connection-options>`
140
+ guide.
145
141
146
- - Maximum wait time in milliseconds that a thread can wait for
147
- a connection to become available. A value of ``0`` means there
148
- is no limit.
149
-
150
- *Default*: ``120000`` (120 seconds)
142
+ .. tab:: MongoClientSettings
143
+ :tabid: MongoClient
151
144
152
- For more information on these connection string options, see the
153
- :ref:`Connection Options <connection-options>`
154
- guide.
145
+ .. literalinclude:: /includes/fundamentals/code-snippets/ConnectionPool.java
146
+ :start-after: begin MongoSettings
147
+ :end-before: end MongoSettings
148
+ :language: java
149
+ :dedent:
155
150
156
- For more information on configuring you connection pool by using a
157
- ``MongoClientSettings`` object see the Connection Pool Settings section
158
- of the :ref:`<specify-mongoclient-settings>` guide.
151
+ For more information on configuring you connection pool by using a
152
+ ``MongoClientSettings`` object see the Connection Pool Settings section
153
+ of the :ref:`<specify-mongoclient-settings>` guide.
159
154
160
155
Additional Information
161
156
----------------------
0 commit comments