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)
Deprecated.
|
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 millisecondsthis
IllegalArgumentException
- if heartbeatFrequency < 1, which must be > 0MongoClientOptions.getHeartbeatFrequency()
public MongoClientOptions.Builder minHeartbeatFrequency(int minHeartbeatFrequency)
minHeartbeatFrequency
- the minimum heartbeat frequency, in milliseconds, which must be > 0this
MongoClientOptions.getMinHeartbeatFrequency()
@Deprecated public MongoClientOptions.Builder heartbeatConnectRetryFrequency(int minHeartbeatFrequency)
minHeartbeatFrequency
minHeartbeatFrequency
- the minimum heartbeat frequency, in milliseconds, which must be > 0this
()
public MongoClientOptions.Builder heartbeatConnectTimeout(int heartbeatConnectTimeout)
heartbeatConnectTimeout
- the heartbeat connect timeout, in millisecondsthis
IllegalArgumentException
- if heartbeatConnectTimeout < 0MongoClientOptions.getHeartbeatConnectTimeout()
public MongoClientOptions.Builder heartbeatSocketTimeout(int heartbeatSocketTimeout)
heartbeatSocketTimeout
- the heartbeat socket timeout, in millisecondsthis
IllegalArgumentException
- if heartbeatSocketTimeout < 0MongoClientOptions.getHeartbeatSocketTimeout()
@Deprecated public MongoClientOptions.Builder heartbeatThreadCount(int heartbeatThreadCount)
heartbeatThreadCount
- the heartbeat thread countthis
IllegalArgumentException
- if heartbeatThreadCount < 1MongoClientOptions.getHeartbeatThreadCount()
@Deprecated public MongoClientOptions.Builder localThreshold(int localThreshold)
localThreshold
- the threshold in millisecondsthis
IllegalArgumentException
- if localThreshold < 0MongoClientOptions.getLocalThreshold()
@Deprecated public MongoClientOptions.Builder acceptableLatencyDifference(int acceptableLatencyDifference)
localThreshold(int)
acceptableLatencyDifference
- the acceptable latency difference, in millisecondsthis
IllegalArgumentException
- if acceptableLatencyDifference < 0MongoClientOptions.getAcceptableLatencyDifference()
public MongoClientOptions.Builder description(String description)
description
- the description of this MongoClientthis
MongoClientOptions.getDescription()
public MongoClientOptions.Builder minConnectionsPerHost(int minConnectionsPerHost)
minConnectionsPerHost
- minimum number of connectionsthis
IllegalArgumentException
- if minConnectionsPerHost < 0
MongoClientOptions.getMinConnectionsPerHost()
public MongoClientOptions.Builder connectionsPerHost(int connectionsPerHost)
connectionsPerHost
- maximum number of connectionsthis
IllegalArgumentException
- if connnectionsPerHost < 1
MongoClientOptions.getConnectionsPerHost()
public MongoClientOptions.Builder threadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)
threadsAllowedToBlockForConnectionMultiplier
- the multiplierthis
IllegalArgumentException
- if threadsAllowedToBlockForConnectionMultiplier < 1
MongoClientOptions.getThreadsAllowedToBlockForConnectionMultiplier()
public MongoClientOptions.Builder maxWaitTime(int maxWaitTime)
maxWaitTime
- the maximum wait time (in milliseconds)this
IllegalArgumentException
- if maxWaitTime < 0
MongoClientOptions.getMaxWaitTime()
public MongoClientOptions.Builder maxConnectionIdleTime(int maxConnectionIdleTime)
maxConnectionIdleTime
- the maximum idle timethis
IllegalArgumentException
- if maxConnectionIdleTime < 0
MongoClientOptions.getMaxConnectionIdleTime()
public MongoClientOptions.Builder maxConnectionLifeTime(int maxConnectionLifeTime)
maxConnectionLifeTime
- the maximum life timethis
IllegalArgumentException
- if maxConnectionIdleTime < 0
MongoClientOptions.getMaxConnectionIdleTime()
public MongoClientOptions.Builder connectTimeout(int connectTimeout)
connectTimeout
- the connection timeout (in milliseconds)this
MongoClientOptions.getConnectTimeout()
public MongoClientOptions.Builder socketTimeout(int socketTimeout)
socketTimeout
- the socket timeout (in milliseconds)this
MongoClientOptions.getSocketTimeout()
public MongoClientOptions.Builder socketKeepAlive(boolean socketKeepAlive)
socketKeepAlive
- keep alivethis
MongoClientOptions.isSocketKeepAlive()
@Deprecated public MongoClientOptions.Builder autoConnectRetry(boolean autoConnectRetry)
autoConnectRetry
- auto connect retrythis
MongoClientOptions.isAutoConnectRetry()
@Deprecated public MongoClientOptions.Builder maxAutoConnectRetryTime(long maxAutoConnectRetryTime)
maxAutoConnectRetryTime
- the maximum auto connect retry timethis
MongoClientOptions.getMaxAutoConnectRetryTime()
public MongoClientOptions.Builder readPreference(ReadPreference readPreference)
readPreference
- read preferencethis
MongoClientOptions.getReadPreference()
public MongoClientOptions.Builder dbDecoderFactory(DBDecoderFactory dbDecoderFactory)
dbDecoderFactory
- the decoder factorythis
MongoClientOptions.getDbDecoderFactory()
public MongoClientOptions.Builder dbEncoderFactory(DBEncoderFactory dbEncoderFactory)
dbEncoderFactory
- the encoder factorythis
MongoClientOptions.getDbEncoderFactory()
public MongoClientOptions.Builder writeConcern(WriteConcern writeConcern)
writeConcern
- the write concernthis
MongoClientOptions.getWriteConcern()
public MongoClientOptions.Builder socketFactory(SocketFactory socketFactory)
socketFactory
- the socket factorythis
MongoClientOptions.getSocketFactory()
public MongoClientOptions.Builder cursorFinalizerEnabled(boolean cursorFinalizerEnabled)
cursorFinalizerEnabled
- whether cursor finalizers are enabled.this
MongoClientOptions.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
.this
MongoOptions
public MongoClientOptions build()