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 MongoClientthisMongoClientOptions.getDescription()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 timethisIllegalArgumentException - if maxWaitTime < 0MongoClientOptions.getMaxWaitTime()public MongoClientOptions.Builder connectTimeout(int connectTimeout)
connectTimeout - the connection timeoutthisMongoClientOptions.getConnectTimeout()public MongoClientOptions.Builder socketTimeout(int socketTimeout)
socketTimeout - the socket timeoutthisMongoClientOptions.getSocketTimeout()public MongoClientOptions.Builder socketKeepAlive(boolean socketKeepAlive)
socketKeepAlive - keep alivethisMongoClientOptions.isSocketKeepAlive()public MongoClientOptions.Builder autoConnectRetry(boolean autoConnectRetry)
autoConnectRetry - auto connect retrythisMongoClientOptions.isAutoConnectRetry()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 legacyDefaults()
MongoOptions.thisMongoOptionspublic MongoClientOptions build()