|
66 | 66 | * <li>{@code ssl=true|false}: Whether to connect using SSL.</li>
|
67 | 67 | * <li>{@code connectTimeoutMS=ms}: How long a connection can take to be opened before timing out.</li>
|
68 | 68 | * <li>{@code socketTimeoutMS=ms}: How long a send or receive on a socket can take before timing out.</li>
|
| 69 | + * <li>{@code maxIdleTimeMS=ms}: Maximum idle time of a pooled connection. A connection that exceeds this limit will be closed</li> |
| 70 | + * <li>{@code maxLifeTimeMS=ms}: Maximum life time of a pooled connection. A connection that exceeds this limit will be closed</li> |
69 | 71 | * </ul>
|
70 | 72 | * <p>Connection pool configuration:</p>
|
71 | 73 | * <ul>
|
72 | 74 | * <li>{@code maxPoolSize=n}: The maximum number of connections in the connection pool.</li>
|
| 75 | + * <li>{@code minPoolSize=n}: The minimum number of connections in the connection pool.</li> |
73 | 76 | * <li>{@code waitQueueMultiple=n} : this multiplier, multiplied with the maxPoolSize setting, gives the maximum number of
|
74 | 77 | * threads that may be waiting for a connection to become available from the pool. All further threads will get an
|
75 | 78 | * exception right away.</li>
|
@@ -262,10 +265,13 @@ public MongoClientURI(String uri, MongoClientOptions.Builder builder) {
|
262 | 265 | static Set<String> allKeys = new HashSet<String>();
|
263 | 266 |
|
264 | 267 | static {
|
| 268 | + generalOptionsKeys.add("minpoolsize"); |
265 | 269 | generalOptionsKeys.add("maxpoolsize");
|
266 | 270 | generalOptionsKeys.add("waitqueuemultiple");
|
267 | 271 | generalOptionsKeys.add("waitqueuetimeoutms");
|
268 | 272 | generalOptionsKeys.add("connecttimeoutms");
|
| 273 | + generalOptionsKeys.add("maxidletimems"); |
| 274 | + generalOptionsKeys.add("maxlifetimems"); |
269 | 275 | generalOptionsKeys.add("sockettimeoutms");
|
270 | 276 | generalOptionsKeys.add("sockettimeoutms");
|
271 | 277 | generalOptionsKeys.add("autoconnectretry");
|
@@ -309,6 +315,12 @@ private MongoClientOptions createOptions(Map<String, List<String>> optionsMap, M
|
309 | 315 |
|
310 | 316 | if (key.equals("maxpoolsize")) {
|
311 | 317 | builder.connectionsPerHost(Integer.parseInt(value));
|
| 318 | + } else if (key.equals("minpoolsize")) { |
| 319 | + builder.minConnectionsPerHost(Integer.parseInt(value)); |
| 320 | + } else if (key.equals("maxidletimems")) { |
| 321 | + builder.maxConnectionIdleTime(Integer.parseInt(value)); |
| 322 | + } else if (key.equals("maxlifetimems")) { |
| 323 | + builder.maxConnectionLifeTime(Integer.parseInt(value)); |
312 | 324 | } else if (key.equals("waitqueuemultiple")) {
|
313 | 325 | builder.threadsAllowedToBlockForConnectionMultiplier(Integer.parseInt(value));
|
314 | 326 | } else if (key.equals("waitqueuetimeoutms")) {
|
|
0 commit comments