Class ConnectionPoolSettings.Builder
- Enclosing class:
ConnectionPoolSettings
-
Method Summary
Modifier and TypeMethodDescriptionaddConnectionPoolListener
(ConnectionPoolListener connectionPoolListener) Deprecated.Adds the given connection pool listener.applyConnectionString
(ConnectionString connectionString) Deprecated.Takes the settings from the givenConnectionString
and applies them to the builderapplySettings
(ConnectionPoolSettings connectionPoolSettings) Deprecated.Applies the connectionPoolSettings to the builderbuild()
Deprecated.Creates a new ConnectionPoolSettings object with the settings initialised on this builder.maintenanceFrequency
(long maintenanceFrequency, TimeUnit timeUnit) Deprecated.The time period between runs of the maintenance job.maintenanceInitialDelay
(long maintenanceInitialDelay, TimeUnit timeUnit) Deprecated.The period of time to wait before running the first maintenance job on the connection pool.maxConnectionIdleTime
(long maxConnectionIdleTime, TimeUnit timeUnit) Deprecated.The maximum idle time of a pooled connection.maxConnectionLifeTime
(long maxConnectionLifeTime, TimeUnit timeUnit) Deprecated.The maximum time a pooled connection can live for.maxSize
(int maxSize) Deprecated.The maximum number of connections allowed.maxWaitQueueSize
(int maxWaitQueueSize) Deprecated.in the next major release, wait queue size limitations will be removedmaxWaitTime
(long maxWaitTime, TimeUnit timeUnit) Deprecated.The maximum time that a thread may wait for a connection to become available.minSize
(int minSize) Deprecated.The minimum number of connections.
-
Method Details
-
applySettings
Deprecated.Applies the connectionPoolSettings to the builderNote: Overwrites all existing settings
- Parameters:
connectionPoolSettings
- the connectionPoolSettings- Returns:
- this
- Since:
- 3.7
-
maxSize
Deprecated.The maximum number of connections allowed. Those connections will be kept in the pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection.
Default is 100.
- Parameters:
maxSize
- the maximum number of connections in the pool.- Returns:
- this
-
minSize
Deprecated.The minimum number of connections. Those connections will be kept in the pool when idle, and the pool will ensure that it contains at least this minimum number.
Default is 0.
- Parameters:
minSize
- the minimum number of connections to have in the pool at all times.- Returns:
- this
-
maxWaitQueueSize
Deprecated.in the next major release, wait queue size limitations will be removedThis is the maximum number of waiters for a connection to become available from the pool. All further operations will get an exception immediately.
Default is 500.
- Parameters:
maxWaitQueueSize
- the number of threads that are allowed to be waiting for a connection.- Returns:
- this
-
maxWaitTime
Deprecated.The maximum time that a thread may wait for a connection to become available.
Default is 2 minutes. A value of 0 means that it will not wait. A negative value means it will wait indefinitely.
- Parameters:
maxWaitTime
- the maximum amount of time to waittimeUnit
- the TimeUnit for this wait period- Returns:
- this
-
maxConnectionLifeTime
public ConnectionPoolSettings.Builder maxConnectionLifeTime(long maxConnectionLifeTime, TimeUnit timeUnit) Deprecated.The maximum time a pooled connection can live for. A zero value indicates no limit to the life time. A pooled connection that has exceeded its life time will be closed and replaced when necessary by a new connection.- Parameters:
maxConnectionLifeTime
- the maximum length of time a connection can livetimeUnit
- the TimeUnit for this time period- Returns:
- this
-
maxConnectionIdleTime
public ConnectionPoolSettings.Builder maxConnectionIdleTime(long maxConnectionIdleTime, TimeUnit timeUnit) Deprecated.The maximum idle time of a pooled connection. A zero value indicates no limit to the idle time. A pooled connection that has exceeded its idle time will be closed and replaced when necessary by a new connection.- Parameters:
maxConnectionIdleTime
- the maximum time a connection can be unusedtimeUnit
- the TimeUnit for this time period- Returns:
- this
-
maintenanceInitialDelay
public ConnectionPoolSettings.Builder maintenanceInitialDelay(long maintenanceInitialDelay, TimeUnit timeUnit) Deprecated.The period of time to wait before running the first maintenance job on the connection pool.- Parameters:
maintenanceInitialDelay
- the time period to waittimeUnit
- the TimeUnit for this time period- Returns:
- this
-
maintenanceFrequency
public ConnectionPoolSettings.Builder maintenanceFrequency(long maintenanceFrequency, TimeUnit timeUnit) Deprecated.The time period between runs of the maintenance job.- Parameters:
maintenanceFrequency
- the time period between runs of the maintenance jobtimeUnit
- the TimeUnit for this time period- Returns:
- this
-
addConnectionPoolListener
public ConnectionPoolSettings.Builder addConnectionPoolListener(ConnectionPoolListener connectionPoolListener) Deprecated.Adds the given connection pool listener.- Parameters:
connectionPoolListener
- the non-null connection pool listener- Returns:
- this
- Since:
- 3.5
-
build
Deprecated.Creates a new ConnectionPoolSettings object with the settings initialised on this builder.- Returns:
- a new ConnectionPoolSettings object
-
applyConnectionString
Deprecated.Takes the settings from the givenConnectionString
and applies them to the builder- Parameters:
connectionString
- the connection string containing details of how to connect to MongoDB- Returns:
- this
-