|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.MongoClientOptions.Builder
public static class MongoClientOptions.Builder
A builder for MongoClientOptions so that MongoClientOptions can be immutable, and to support easier construction through chaining.
Constructor Summary | |
---|---|
MongoClientOptions.Builder()
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MongoClientOptions.Builder()
Method Detail |
---|
public MongoClientOptions.Builder description(String description)
description
- the description of this MongoClient
this
MongoClientOptions.getDescription()
public MongoClientOptions.Builder connectionsPerHost(int connectionsPerHost)
connectionsPerHost
- maximum number of connections
this
IllegalArgumentException
- if connnectionsPerHost < 1
MongoClientOptions.getConnectionsPerHost()
public MongoClientOptions.Builder threadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)
threadsAllowedToBlockForConnectionMultiplier
- the multiplier
this
IllegalArgumentException
- if threadsAllowedToBlockForConnectionMultiplier < 1
MongoClientOptions.getThreadsAllowedToBlockForConnectionMultiplier()
public MongoClientOptions.Builder maxWaitTime(int maxWaitTime)
maxWaitTime
- the maximum wait time
this
IllegalArgumentException
- if maxWaitTime < 0
MongoClientOptions.getMaxWaitTime()
public MongoClientOptions.Builder connectTimeout(int connectTimeout)
connectTimeout
- the connection timeout
this
MongoClientOptions.getConnectTimeout()
public MongoClientOptions.Builder socketTimeout(int socketTimeout)
socketTimeout
- the socket timeout
this
MongoClientOptions.getSocketTimeout()
public MongoClientOptions.Builder socketKeepAlive(boolean socketKeepAlive)
socketKeepAlive
- keep alive
this
MongoClientOptions.isSocketKeepAlive()
public MongoClientOptions.Builder autoConnectRetry(boolean autoConnectRetry)
autoConnectRetry
- auto connect retry
this
MongoClientOptions.isAutoConnectRetry()
public MongoClientOptions.Builder maxAutoConnectRetryTime(long maxAutoConnectRetryTime)
maxAutoConnectRetryTime
- the maximum auto connect retry time
this
MongoClientOptions.getMaxAutoConnectRetryTime()
public MongoClientOptions.Builder readPreference(ReadPreference readPreference)
readPreference
- read preference
this
MongoClientOptions.getReadPreference()
public MongoClientOptions.Builder dbDecoderFactory(DBDecoderFactory dbDecoderFactory)
dbDecoderFactory
- the decoder factory
this
MongoClientOptions.getDbDecoderFactory()
public MongoClientOptions.Builder dbEncoderFactory(DBEncoderFactory dbEncoderFactory)
dbEncoderFactory
- the encoder factory
this
MongoClientOptions.getDbEncoderFactory()
public MongoClientOptions.Builder writeConcern(WriteConcern writeConcern)
writeConcern
- the write concern
this
MongoClientOptions.getWriteConcern()
public MongoClientOptions.Builder socketFactory(SocketFactory socketFactory)
socketFactory
- the socket factory
this
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 version
MongoClientOptions.isAlwaysUseMBeans()
public MongoClientOptions.Builder legacyDefaults()
MongoOptions
.
this
MongoOptions
public MongoClientOptions build()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |