public static class MongoClientOptions.Builder extends Object
Constructor and Description |
---|
MongoClientOptions.Builder() |
Modifier and Type | Method and Description |
---|---|
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)
Sets whether auto connect retry is enabled.
|
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 |
legacyDefaults()
Sets defaults to be what they are in
MongoOptions . |
MongoClientOptions.Builder |
maxAutoConnectRetryTime(long maxAutoConnectRetryTime)
Sets the maximum auto connect retry time.
|
MongoClientOptions.Builder |
maxWaitTime(int maxWaitTime)
Sets the maximum time that a thread will block waiting for a connection.
|
MongoClientOptions.Builder |
readPreference(ReadPreference readPreference)
Sets the read preference.
|
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 description(String description)
description
- the description of this MongoClientthis
MongoClientOptions.getDescription()
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 timethis
IllegalArgumentException
- if maxWaitTime < 0
MongoClientOptions.getMaxWaitTime()
public MongoClientOptions.Builder connectTimeout(int connectTimeout)
connectTimeout
- the connection timeoutthis
MongoClientOptions.getConnectTimeout()
public MongoClientOptions.Builder socketTimeout(int socketTimeout)
socketTimeout
- the socket timeoutthis
MongoClientOptions.getSocketTimeout()
public MongoClientOptions.Builder socketKeepAlive(boolean socketKeepAlive)
socketKeepAlive
- keep alivethis
MongoClientOptions.isSocketKeepAlive()
public MongoClientOptions.Builder autoConnectRetry(boolean autoConnectRetry)
autoConnectRetry
- auto connect retrythis
MongoClientOptions.isAutoConnectRetry()
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 legacyDefaults()
MongoOptions
.this
MongoOptions
public MongoClientOptions build()