public static class MongoClientOptions.Builder extends Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
MongoClientOptions.Builder |
acceptableLatencyDifference(int acceptableLatencyDifference)
Deprecated.
|
MongoClientOptions.Builder |
alwaysUseMBeans(boolean alwaysUseMBeans)
Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater.
|
MongoClientOptions.Builder |
autoConnectRetry(boolean autoConnectRetry)
Deprecated.
There is no replacement for this method. Use the connectTimeout property to control connection timeout.
|
MongoClientOptions |
build()
Build an instance of MongoClientOptions.
|
MongoClientOptions.Builder |
connectionsPerHost(int connectionsPerHost)
Sets the maximum number of connections per host.
|
MongoClientOptions.Builder |
connectTimeout(int connectTimeout)
Sets the connection timeout.
|
MongoClientOptions.Builder |
cursorFinalizerEnabled(boolean cursorFinalizerEnabled)
Sets whether cursor finalizers are enabled.
|
MongoClientOptions.Builder |
dbDecoderFactory(DBDecoderFactory dbDecoderFactory)
Sets the decoder factory.
|
MongoClientOptions.Builder |
dbEncoderFactory(DBEncoderFactory dbEncoderFactory)
Sets the encoder factory.
|
MongoClientOptions.Builder |
description(String description)
Sets the description.
|
MongoClientOptions.Builder |
heartbeatConnectRetryFrequency(int minHeartbeatFrequency)
Deprecated.
replaced by
minHeartbeatFrequency |
MongoClientOptions.Builder |
heartbeatConnectTimeout(int heartbeatConnectTimeout)
Sets the heartbeat connect timeout.
|
MongoClientOptions.Builder |
heartbeatFrequency(int heartbeatFrequency)
Sets the heartbeat frequency.
|
MongoClientOptions.Builder |
heartbeatSocketTimeout(int heartbeatSocketTimeout)
Sets the heartbeat connect socket timeout.
|
MongoClientOptions.Builder |
heartbeatThreadCount(int heartbeatThreadCount)
Deprecated.
this is no longer a configurable property
|
MongoClientOptions.Builder |
legacyDefaults()
Sets defaults to be what they are in
MongoOptions. |
MongoClientOptions.Builder |
localThreshold(int localThreshold)
Sets the local threshold.
|
MongoClientOptions.Builder |
maxAutoConnectRetryTime(long maxAutoConnectRetryTime)
Deprecated.
There is no replacement for this method. Use the connectTimeout property to control connection timeout.
|
MongoClientOptions.Builder |
maxConnectionIdleTime(int maxConnectionIdleTime)
Sets the maximum idle time for a pooled connection.
|
MongoClientOptions.Builder |
maxConnectionLifeTime(int maxConnectionLifeTime)
Sets the maximum life time for a pooled connection.
|
MongoClientOptions.Builder |
maxWaitTime(int maxWaitTime)
Sets the maximum time that a thread will block waiting for a connection.
|
MongoClientOptions.Builder |
minConnectionsPerHost(int minConnectionsPerHost)
Sets the minimum number of connections per host.
|
MongoClientOptions.Builder |
minHeartbeatFrequency(int minHeartbeatFrequency)
Sets the minimum heartbeat frequency.
|
MongoClientOptions.Builder |
readPreference(ReadPreference readPreference)
Sets the read preference.
|
MongoClientOptions.Builder |
requiredReplicaSetName(String requiredReplicaSetName)
Sets the required replica set name for the cluster.
|
MongoClientOptions.Builder |
socketFactory(SocketFactory socketFactory)
Sets the socket factory.
|
MongoClientOptions.Builder |
socketKeepAlive(boolean socketKeepAlive)
Sets whether socket keep alive is enabled.
|
MongoClientOptions.Builder |
socketTimeout(int socketTimeout)
Sets the socket timeout.
|
MongoClientOptions.Builder |
threadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)
Sets the multiplier for number of threads allowed to block waiting for a connection.
|
MongoClientOptions.Builder |
writeConcern(WriteConcern writeConcern)
Sets the write concern.
|
public MongoClientOptions.Builder heartbeatFrequency(int heartbeatFrequency)
heartbeatFrequency - the heartbeat frequency, in millisecondsthisIllegalArgumentException - if heartbeatFrequency < 1, which must be > 0MongoClientOptions.getHeartbeatFrequency()public MongoClientOptions.Builder minHeartbeatFrequency(int minHeartbeatFrequency)
minHeartbeatFrequency - the minimum heartbeat frequency, in milliseconds, which must be > 0thisMongoClientOptions.getMinHeartbeatFrequency()@Deprecated public MongoClientOptions.Builder heartbeatConnectRetryFrequency(int minHeartbeatFrequency)
minHeartbeatFrequencyminHeartbeatFrequency - the minimum heartbeat frequency, in milliseconds, which must be > 0this()public MongoClientOptions.Builder heartbeatConnectTimeout(int heartbeatConnectTimeout)
heartbeatConnectTimeout - the heartbeat connect timeout, in millisecondsthisIllegalArgumentException - if heartbeatConnectTimeout < 0MongoClientOptions.getHeartbeatConnectTimeout()public MongoClientOptions.Builder heartbeatSocketTimeout(int heartbeatSocketTimeout)
heartbeatSocketTimeout - the heartbeat socket timeout, in millisecondsthisIllegalArgumentException - if heartbeatSocketTimeout < 0MongoClientOptions.getHeartbeatSocketTimeout()@Deprecated public MongoClientOptions.Builder heartbeatThreadCount(int heartbeatThreadCount)
heartbeatThreadCount - the heartbeat thread countthisIllegalArgumentException - if heartbeatThreadCount < 1MongoClientOptions.getHeartbeatThreadCount()public MongoClientOptions.Builder localThreshold(int localThreshold)
localThreshold - the threshold in millisecondsthisIllegalArgumentException - if localThreshold < 0MongoClientOptions.getLocalThreshold()@Deprecated public MongoClientOptions.Builder acceptableLatencyDifference(int acceptableLatencyDifference)
localThreshold(int)acceptableLatencyDifference - the acceptable latency difference, in millisecondsthisIllegalArgumentException - if acceptableLatencyDifference < 0MongoClientOptions.getAcceptableLatencyDifference()public MongoClientOptions.Builder description(String description)
description - the description of this MongoClientthisMongoClientOptions.getDescription()public MongoClientOptions.Builder minConnectionsPerHost(int minConnectionsPerHost)
minConnectionsPerHost - minimum number of connectionsthisIllegalArgumentException - if minConnectionsPerHost < 0MongoClientOptions.getMinConnectionsPerHost()public MongoClientOptions.Builder connectionsPerHost(int connectionsPerHost)
connectionsPerHost - maximum number of connectionsthisIllegalArgumentException - if connnectionsPerHost < 1MongoClientOptions.getConnectionsPerHost()public MongoClientOptions.Builder threadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)
threadsAllowedToBlockForConnectionMultiplier - the multiplierthisIllegalArgumentException - if threadsAllowedToBlockForConnectionMultiplier < 1MongoClientOptions.getThreadsAllowedToBlockForConnectionMultiplier()public MongoClientOptions.Builder maxWaitTime(int maxWaitTime)
maxWaitTime - the maximum wait time (in milliseconds)thisIllegalArgumentException - if maxWaitTime < 0MongoClientOptions.getMaxWaitTime()public MongoClientOptions.Builder maxConnectionIdleTime(int maxConnectionIdleTime)
maxConnectionIdleTime - the maximum idle timethisIllegalArgumentException - if maxConnectionIdleTime < 0MongoClientOptions.getMaxConnectionIdleTime()public MongoClientOptions.Builder maxConnectionLifeTime(int maxConnectionLifeTime)
maxConnectionLifeTime - the maximum life timethisIllegalArgumentException - if maxConnectionIdleTime < 0MongoClientOptions.getMaxConnectionIdleTime()public MongoClientOptions.Builder connectTimeout(int connectTimeout)
connectTimeout - the connection timeout (in milliseconds)thisMongoClientOptions.getConnectTimeout()public MongoClientOptions.Builder socketTimeout(int socketTimeout)
socketTimeout - the socket timeout (in milliseconds)thisMongoClientOptions.getSocketTimeout()public MongoClientOptions.Builder socketKeepAlive(boolean socketKeepAlive)
socketKeepAlive - keep alivethisMongoClientOptions.isSocketKeepAlive()@Deprecated public MongoClientOptions.Builder autoConnectRetry(boolean autoConnectRetry)
autoConnectRetry - auto connect retrythisMongoClientOptions.isAutoConnectRetry()@Deprecated public MongoClientOptions.Builder maxAutoConnectRetryTime(long maxAutoConnectRetryTime)
maxAutoConnectRetryTime - the maximum auto connect retry timethisMongoClientOptions.getMaxAutoConnectRetryTime()public MongoClientOptions.Builder readPreference(ReadPreference readPreference)
readPreference - read preferencethisMongoClientOptions.getReadPreference()public MongoClientOptions.Builder dbDecoderFactory(DBDecoderFactory dbDecoderFactory)
dbDecoderFactory - the decoder factorythisMongoClientOptions.getDbDecoderFactory()public MongoClientOptions.Builder dbEncoderFactory(DBEncoderFactory dbEncoderFactory)
dbEncoderFactory - the encoder factorythisMongoClientOptions.getDbEncoderFactory()public MongoClientOptions.Builder writeConcern(WriteConcern writeConcern)
writeConcern - the write concernthisMongoClientOptions.getWriteConcern()public MongoClientOptions.Builder socketFactory(SocketFactory socketFactory)
socketFactory - the socket factorythisMongoClientOptions.getSocketFactory()public MongoClientOptions.Builder cursorFinalizerEnabled(boolean cursorFinalizerEnabled)
cursorFinalizerEnabled - whether cursor finalizers are enabled.thisMongoClientOptions.isCursorFinalizerEnabled()public MongoClientOptions.Builder alwaysUseMBeans(boolean alwaysUseMBeans)
alwaysUseMBeans - true if driver should always use MBeans, regardless of VM versionMongoClientOptions.isAlwaysUseMBeans()public MongoClientOptions.Builder requiredReplicaSetName(String requiredReplicaSetName)
requiredReplicaSetName - the required replica set name for the replica set.MongoClientOptions.getRequiredReplicaSetName()public MongoClientOptions.Builder legacyDefaults()
MongoOptions.thisMongoOptionspublic MongoClientOptions build()