|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mongodb.MongoClientOptions
@Immutable public class MongoClientOptions
Various settings to control the behavior of a MongoClient
.
Note: This class is a replacement for MongoOptions
, to be used with MongoClient
. The main difference
in behavior is that the default write concern is WriteConcern.ACKNOWLEDGED
.
MongoClient
Nested Class Summary | |
---|---|
static class |
MongoClientOptions.Builder
A builder for MongoClientOptions so that MongoClientOptions can be immutable, and to support easier construction through chaining. |
Method Summary | |
---|---|
int |
getConnectionsPerHost()
The maximum number of connections allowed per host for this MongoClient instance. |
int |
getConnectTimeout()
The connection timeout in milliseconds. |
DBDecoderFactory |
getDbDecoderFactory()
Override the decoder factory. |
DBEncoderFactory |
getDbEncoderFactory()
Override the encoder factory. |
String |
getDescription()
Gets the description for this MongoClient, which is used in various places like logging and JMX. |
long |
getMaxAutoConnectRetryTime()
The maximum amount of time in MS to spend retrying to open connection to the same server. |
int |
getMaxWaitTime()
The maximum wait time in milliseconds that a thread may wait for a connection to become available. |
ReadPreference |
getReadPreference()
The read preference to use for queries, map-reduce, aggregation, and count. |
SocketFactory |
getSocketFactory()
The socket factory for creating sockets to the mongo server. |
int |
getSocketTimeout()
The socket timeout in milliseconds. |
int |
getThreadsAllowedToBlockForConnectionMultiplier()
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. |
WriteConcern |
getWriteConcern()
The write concern to use. |
boolean |
isAutoConnectRetry()
If true, the driver will keep trying to connect to the same server in case that the socket cannot be established. |
boolean |
isCursorFinalizerEnabled()
Sets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close. |
boolean |
isSocketKeepAlive()
This flag controls the socket keep alive feature that keeps a connection alive through firewalls Socket.setKeepAlive(boolean) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public String getDescription()
Default is null.
public int getConnectionsPerHost()
Default is 100.
getThreadsAllowedToBlockForConnectionMultiplier()
public int getThreadsAllowedToBlockForConnectionMultiplier()
Default is 5.
public int getMaxWaitTime()
Default is 120,000. A value of 0 means that it will not wait. A negative value means to wait indefinitely.
public int getConnectTimeout()
Socket.connect(java.net.SocketAddress, int)
Default is 10,000.
public int getSocketTimeout()
Socket.setSoTimeout(int)
Default is 0 and means no timeout.
public boolean isSocketKeepAlive()
Socket.setKeepAlive(boolean)
* Default is false.
public boolean isAutoConnectRetry()
public long getMaxAutoConnectRetryTime()
public ReadPreference getReadPreference()
Default is ReadPreference.primary()
.
ReadPreference.primary()
public DBDecoderFactory getDbDecoderFactory()
public DBEncoderFactory getDbEncoderFactory()
public WriteConcern getWriteConcern()
Default is WriteConcern.ACKNOWLEDGED
.
WriteConcern.ACKNOWLEDGED
public SocketFactory getSocketFactory()
Default is SocketFactory.getDefault()
public boolean isCursorFinalizerEnabled()
Default is true.
DBCursor
,
DBCursor.close()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |