org.springframework.data.document.mongodb
Class MongoOptionsFactoryBean

java.lang.Object
  extended by org.springframework.data.document.mongodb.MongoOptionsFactoryBean

public class MongoOptionsFactoryBean
extends java.lang.Object

A factory bean for construction of a MongoOptions instance

Author:
Graeme Rocher

Field Summary
private  boolean autoConnectRetry
          this controls whether or not on a connect, the system retries automatically
private  int connectionsPerHost
          number of connections allowed per host will block if run out
private  int connectTimeout
          connect timeout in milliseconds.
private  int maxWaitTime
          max wait time of a blocking thread for a connection
private static MongoOptions MONGO_OPTIONS
           
private  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).
private  int socketTimeout
          socket timeout.
private  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
private  boolean writeFsync
          This controls whether or not to fsync.
private  int writeNumber
          This specifies the number of servers to wait for on the write operation, and exception raising behavior.
private  int writeTimeout
          This controls timeout for write operations in milliseconds.
 
Constructor Summary
MongoOptionsFactoryBean()
           
 
Method Summary
 void afterPropertiesSet()
           
 MongoOptions getObject()
           
 java.lang.Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setAutoConnectRetry(boolean autoConnectRetry)
          this controls whether or not on a connect, the system retries automatically
 void setConnectionsPerHost(int connectionsPerHost)
          number of connections allowed per host will block if run out
 void setConnectTimeout(int connectTimeout)
          connect timeout in milliseconds.
 void setMaxWaitTime(int maxWaitTime)
          max wait time of a blocking thread for a connection
 void setSlaveOk(boolean slaveOk)
          Specifies if the driver is allowed to read from secondaries or slaves.
 void setSocketKeepAlive(boolean socketKeepAlive)
          This controls whether or not to have socket keep alive
 void setSocketTimeout(int socketTimeout)
          socket timeout.
 void setThreadsAllowedToBlockForConnectionMultiplier(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
 void setWriteFsync(boolean writeFsync)
          This controls whether or not to fsync.
 void setWriteNumber(int writeNumber)
          This specifies the number of servers to wait for on the write operation, and exception raising behavior.
 void setWriteTimeout(int writeTimeout)
          This controls timeout for write operations in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MONGO_OPTIONS

private static final MongoOptions MONGO_OPTIONS

connectionsPerHost

private int connectionsPerHost
number of connections allowed per host will block if run out


threadsAllowedToBlockForConnectionMultiplier

private 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

private int maxWaitTime
max wait time of a blocking thread for a connection


connectTimeout

private int connectTimeout
connect timeout in milliseconds. 0 is default and infinite


socketTimeout

private int socketTimeout
socket timeout. 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

private boolean autoConnectRetry
this controls whether or not on a connect, the system retries automatically


writeNumber

private int writeNumber
This specifies the number of servers to wait for on the write operation, and exception raising behavior. Defaults to 0.


writeTimeout

private int writeTimeout
This controls timeout for write operations in milliseconds. Defaults to 0 (indefinite). Greater than zero is number of milliseconds to wait.


writeFsync

private boolean writeFsync
This controls whether or not to fsync. Defaults to false.


slaveOk

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

Constructor Detail

MongoOptionsFactoryBean

public MongoOptionsFactoryBean()
Method Detail

setConnectionsPerHost

public void setConnectionsPerHost(int connectionsPerHost)
number of connections allowed per host will block if run out


setThreadsAllowedToBlockForConnectionMultiplier

public void setThreadsAllowedToBlockForConnectionMultiplier(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


setMaxWaitTime

public void setMaxWaitTime(int maxWaitTime)
max wait time of a blocking thread for a connection


setConnectTimeout

public void setConnectTimeout(int connectTimeout)
connect timeout in milliseconds. 0 is default and infinite


setSocketTimeout

public void setSocketTimeout(int socketTimeout)
socket timeout. 0 is default and infinite


setSocketKeepAlive

public void setSocketKeepAlive(boolean socketKeepAlive)
This controls whether or not to have socket keep alive

Parameters:
socketKeepAlive -

setWriteNumber

public void setWriteNumber(int writeNumber)
This specifies the number of servers to wait for on the write operation, and exception raising behavior. The 'w' option to the getlasterror command. Defaults to 0.

Parameters:
writeNumber - the number of servers to wait for on the write operation, and exception raising behavior.

setWriteTimeout

public void setWriteTimeout(int writeTimeout)
This controls timeout for write operations in milliseconds. The 'wtimeout' option to the getlasterror command.

Parameters:
writeTimeout - Defaults to 0 (indefinite). Greater than zero is number of milliseconds to wait.

setWriteFsync

public void setWriteFsync(boolean writeFsync)
This controls whether or not to fsync. The 'fsync' option to the getlasterror command. Defaults to false.

Parameters:
writeFsync - to fsync on write (true), otherwise false.

setAutoConnectRetry

public void setAutoConnectRetry(boolean autoConnectRetry)
this controls whether or not on a connect, the system retries automatically


setSlaveOk

public void setSlaveOk(boolean slaveOk)
Specifies if the driver is allowed to read from secondaries or slaves. Defaults to false.

Parameters:
slaveOk - true if the driver should read from secondaries or slaves.

afterPropertiesSet

public void afterPropertiesSet()

getObject

public MongoOptions getObject()

getObjectType

public java.lang.Class<?> getObjectType()

isSingleton

public boolean isSingleton()