com.mongodb
Class MongoOptions

java.lang.Object
  extended by com.mongodb.MongoOptions

public class MongoOptions
extends Object

Various settings for the driver


Field Summary
 boolean autoConnectRetry
          This controls whether the system retries automatically on connection errors.
 int connectionsPerHost
          The number of connections allowed per host (the pool size, per host)
 int connectTimeout
          The connection timeout in milliseconds; this is for establishing the socket connections (open).
 DBCallbackFactory dbCallbackFactory
          Override the DBCallback factory.
 boolean fsync
          Sets the fsync value of WriteConcern for the connection.
 int maxWaitTime
          The max wait time for a blocking thread for a connection from the pool in ms.
 boolean safe
          If true the driver sends a getLastError command after every update to ensure it succeeded (see also w and wtimeout) If false, the driver does not send a getlasterror command after every update.
 boolean slaveOk
          Specifies if the driver is allowed to read from secondaries or slaves.
 boolean socketKeepAlive
          This controls whether or not to have socket keep alive turned on (SO_KEEPALIVE).
 int socketTimeout
          The socket timeout; this value is passed to Socket.setSoTimeout(int).
 int threadsAllowedToBlockForConnectionMultiplier
          multiplier for connectionsPerHost for # of threads that can block if connectionsPerHost is 10, and threadsAllowedToBlockForConnectionMultiplier is 5, then 50 threads can block more than that and an exception will be throw
 int w
          If set, the w value of WriteConcern for the connection is set to this.
 int wtimeout
          If set, the wtimeout value of WriteConcern for the connection is set to this.
 
Constructor Summary
MongoOptions()
           
 
Method Summary
 WriteConcern getWriteConcern()
          Helper method to return the appropriate WriteConcern instance based on the current related options settings.
 void reset()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

connectionsPerHost

public int connectionsPerHost

The number of connections allowed per host (the pool size, per host)

Once the pool is exhausted, this will block.

See Also:
MongoOptions#threadsAllowedToBlockForConnectionMultiplier}


threadsAllowedToBlockForConnectionMultiplier

public int threadsAllowedToBlockForConnectionMultiplier
multiplier for connectionsPerHost for # of threads that can block if connectionsPerHost is 10, and threadsAllowedToBlockForConnectionMultiplier is 5, then 50 threads can block more than that and an exception will be throw


maxWaitTime

public int maxWaitTime
The max wait time for a blocking thread for a connection from the pool in ms.


connectTimeout

public int connectTimeout
The connection timeout in milliseconds; this is for establishing the socket connections (open). 0 is default and infinite


socketTimeout

public int socketTimeout
The socket timeout; this value is passed to Socket.setSoTimeout(int). 0 is default and infinite


socketKeepAlive

public boolean socketKeepAlive
This controls whether or not to have socket keep alive turned on (SO_KEEPALIVE). defaults to false


autoConnectRetry

public boolean autoConnectRetry
This controls whether the system retries automatically on connection errors. defaults to false


slaveOk

public boolean slaveOk
Specifies if the driver is allowed to read from secondaries or slaves. defaults to false


dbCallbackFactory

public DBCallbackFactory dbCallbackFactory
Override the DBCallback factory. Default is for the standard Mongo Java driver configuration.


safe

public boolean safe
If true the driver sends a getLastError command after every update to ensure it succeeded (see also w and wtimeout) If false, the driver does not send a getlasterror command after every update. defaults to false


w

public int w
If set, the w value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true


wtimeout

public int wtimeout
If set, the wtimeout value of WriteConcern for the connection is set to this. Defaults to 0; implies safe = true


fsync

public boolean fsync
Sets the fsync value of WriteConcern for the connection. Defaults to false; implies safe = true

Constructor Detail

MongoOptions

public MongoOptions()
Method Detail

reset

public void reset()

getWriteConcern

public WriteConcern getWriteConcern()
Helper method to return the appropriate WriteConcern instance based on the current related options settings.


toString

public String toString()
Overrides:
toString in class Object