|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.MongoOptions
public class MongoOptions
Various settings for a Mongo instance. Not thread safe, and superseded by MongoClientOptions. This class may be deprecated in a future release.
MongoClientOptions
,
MongoClient
Field Summary | |
---|---|
boolean |
alwaysUseMBeans
Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater. |
boolean |
autoConnectRetry
If true, the driver will keep trying to connect to the same server in case that the socket cannot be established. |
int |
connectionsPerHost
The maximum number of connections allowed per host for this Mongo instance. |
int |
connectTimeout
The connection timeout in milliseconds. |
boolean |
cursorFinalizerEnabled
Sets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close. |
DBDecoderFactory |
dbDecoderFactory
Override the DBCallback factory. |
DBEncoderFactory |
dbEncoderFactory
Override the encoding factory. |
String |
description
The description for Mongo instances created with these options. |
boolean |
fsync
The "fsync" value of the global WriteConcern. |
boolean |
j
The "j" value of the global WriteConcern. |
long |
maxAutoConnectRetryTime
The maximum amount of time in MS to spend retrying to open connection to the same server. |
int |
maxWaitTime
The maximum wait time in milliseconds that a thread may wait for a connection to become available. |
ReadPreference |
readPreference
Specifies the read preference. |
boolean |
safe
If true the driver will use a WriteConcern of WriteConcern.SAFE for all operations. |
boolean |
slaveOk
Deprecated. Replaced with ReadPreference.secondaryPreferred() |
SocketFactory |
socketFactory
sets the socket factory for creating sockets to mongod Default is SocketFactory.getDefault() |
boolean |
socketKeepAlive
This flag controls the socket keep alive feature that keeps a connection alive through firewalls Socket.setKeepAlive(boolean)
Default is false. |
int |
socketTimeout
The socket timeout in milliseconds It is used for I/O socket read and write operations Socket.setSoTimeout(int)
Default is 0 and means no timeout. |
int |
threadsAllowedToBlockForConnectionMultiplier
this multiplier, multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool. |
int |
w
The "w" value, (number of writes), of the global WriteConcern. |
WriteConcern |
writeConcern
Sets the write concern. |
int |
wtimeout
The "wtimeout" value of the global WriteConcern. |
Constructor Summary | |
---|---|
MongoOptions()
Deprecated. |
|
MongoOptions(MongoClientOptions options)
Deprecated. Replaced by MongoClientOptions |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public String description
The description for Mongo
instances created with these options. This is used in various places like logging.
public int connectionsPerHost
MongoOptions#threadsAllowedToBlockForConnectionMultiplier}
public int threadsAllowedToBlockForConnectionMultiplier
public int maxWaitTime
public int connectTimeout
Socket.connect(java.net.SocketAddress, int)
Default is 10,000.
public int socketTimeout
Socket.setSoTimeout(int)
Default is 0 and means no timeout.
public boolean socketKeepAlive
Socket.setKeepAlive(boolean)
Default is false.
public boolean autoConnectRetry
public long maxAutoConnectRetryTime
@Deprecated public boolean slaveOk
ReadPreference.secondaryPreferred()
ReadPreference.secondaryPreferred()
public ReadPreference readPreference
public DBDecoderFactory dbDecoderFactory
public DBEncoderFactory dbEncoderFactory
public boolean safe
public int w
public int wtimeout
public boolean fsync
public boolean j
public SocketFactory socketFactory
public boolean cursorFinalizerEnabled
Default is true.
public WriteConcern writeConcern
w
,
safe
,
wtimeout
,
fsync
,
j
public boolean alwaysUseMBeans
Default is false.
Constructor Detail |
---|
@Deprecated public MongoOptions()
@Deprecated public MongoOptions(MongoClientOptions options)
MongoClientOptions
Method Detail |
---|
public void reset()
public MongoOptions copy()
public WriteConcern getWriteConcern()
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String getDescription()
MongoClient
instances created with these optionspublic void setDescription(String desc)
desc
- The description for Mongo
instances created with these optionspublic int getConnectionsPerHost()
public void setConnectionsPerHost(int connections)
connections
- sets the maximum number of connections allowed per host for this Mongo instancepublic int getThreadsAllowedToBlockForConnectionMultiplier()
public void setThreadsAllowedToBlockForConnectionMultiplier(int threads)
threads
- multiplied with connectionsPerHost, sets the maximum number of threads that
may be waiting for a connectionpublic int getMaxWaitTime()
public void setMaxWaitTime(int timeMS)
timeMS
- set the maximum time in milliseconds that threads wait for a connectionpublic int getConnectTimeout()
public void setConnectTimeout(int timeoutMS)
timeoutMS
- set the connection timeout in milliseconds.public int getSocketTimeout()
public void setSocketTimeout(int timeoutMS)
timeoutMS
- set the socket timeout in millisecondspublic boolean isSocketKeepAlive()
public void setSocketKeepAlive(boolean keepAlive)
keepAlive
- set connection keep-alive flagpublic boolean isAutoConnectRetry()
public void setAutoConnectRetry(boolean retry)
retry
- sets keep trying connection flagpublic long getMaxAutoConnectRetryTime()
public void setMaxAutoConnectRetryTime(long retryTimeMS)
retryTimeMS
- set max time in MS to retrying open connectionpublic DBDecoderFactory getDbDecoderFactory()
public void setDbDecoderFactory(DBDecoderFactory factory)
factory
- sets the DBCallback decoding factorypublic DBEncoderFactory getDbEncoderFactory()
public void setDbEncoderFactory(DBEncoderFactory factory)
factory
- sets the encoding factorypublic boolean isSafe()
public void setSafe(boolean isSafe)
isSafe
- true if driver uses WriteConcern.SAFE for all operations.public int getW()
public void setW(int val)
val
- set the number of writes of the global WriteConcern.public int getWtimeout()
public void setWtimeout(int timeoutMS)
timeoutMS
- sets timeout for write operationpublic boolean isFsync()
public void setFsync(boolean sync)
sync
- sets global write concern's fsync safe valuepublic boolean isJ()
public void setJ(boolean safe)
safe
- sets global write concern's journal safe valuepublic void setWriteConcern(WriteConcern writeConcern)
writeConcern
- sets the write concernpublic SocketFactory getSocketFactory()
public void setSocketFactory(SocketFactory factory)
factory
- sets the socket factory for creating sockets to mongodpublic ReadPreference getReadPreference()
public void setReadPreference(ReadPreference readPreference)
readPreference
- the read preferencepublic boolean isCursorFinalizerEnabled()
public void setCursorFinalizerEnabled(boolean cursorFinalizerEnabled)
cursorFinalizerEnabled
- whether cursor finalizer is enabledpublic boolean isAlwaysUseMBeans()
public void setAlwaysUseMBeans(boolean alwaysUseMBeans)
alwaysUseMBeans
- sets whether the driver should always use MBeans, regardless of VMpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |