Package com.mongodb
Class MongoOptions
- java.lang.Object
-
- com.mongodb.MongoOptions
-
Deprecated.Please useMongoClientOptionsinstead.
@Deprecated public class MongoOptions extends Object
Various settings for a Mongo instance. Not thread safe, and superseded by MongoClientOptions. This class may be deprecated in a future release.- See Also:
MongoClientOptions,MongoClient
-
-
Field Summary
Fields Modifier and Type Field Description booleanalwaysUseMBeansDeprecated.Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater.intconnectionsPerHostDeprecated.The maximum number of connections allowed per host for this Mongo instance.intconnectTimeoutDeprecated.The connection timeout in milliseconds.booleancursorFinalizerEnabledDeprecated.Sets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close.DBDecoderFactorydbDecoderFactoryDeprecated.Override the DBCallback factory.DBEncoderFactorydbEncoderFactoryDeprecated.Override the encoding factory.StringdescriptionDeprecated.The description forMongoinstances created with these options.booleanfsyncDeprecated.The "fsync" value of the global WriteConcern.booleanjDeprecated.The "j" value of the global WriteConcern.intmaxWaitTimeDeprecated.The maximum wait time in milliseconds that a thread may wait for a connection to become available.ReadPreferencereadPreferenceDeprecated.Specifies the read preference.booleansafeDeprecated.Iftruethe driver will use a WriteConcern of WriteConcern.SAFE for all operations.SocketFactorysocketFactoryDeprecated.Sets the socket factory for creating sockets to mongod Default is SocketFactory.getDefault()booleansocketKeepAliveDeprecated.This flag controls the socket keep alive feature that keeps a connection alive through firewallsSocket.setKeepAlive(boolean)Default is false.intsocketTimeoutDeprecated.The socket timeout in milliseconds It is used for I/O socket read and write operationsSocket.setSoTimeout(int)Default is 0 and means no timeout.intthreadsAllowedToBlockForConnectionMultiplierDeprecated.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.intwDeprecated.The "w" value, (number of writes), of the global WriteConcern.WriteConcernwriteConcernDeprecated.Sets the write concern.intwtimeoutDeprecated.The "wtimeout" value of the global WriteConcern.
-
Constructor Summary
Constructors Constructor Description MongoOptions()Deprecated.MongoOptions(MongoClientOptions options)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MongoOptionscopy()Deprecated.Copy this MongoOptions instance into a new instance.booleanequals(Object o)Deprecated.intgetConnectionsPerHost()Deprecated.Gets the maximum number of connections allowed per host for this Mongo instance.intgetConnectTimeout()Deprecated.Gets the connection timeout in milliseconds.DBDecoderFactorygetDbDecoderFactory()Deprecated.Gets the DBCallback factory.DBEncoderFactorygetDbEncoderFactory()Deprecated.Gets the encoding factory.StringgetDescription()Deprecated.Gets the description forMongoinstances created with these options.intgetMaxWaitTime()Deprecated.Gets the maximum wait time in milliseconds that a thread may wait for a connection to become available.ReadPreferencegetReadPreference()Deprecated.Gets the read preference.StringgetRequiredReplicaSetName()Deprecated.Gets the required replica set name that this client should be connecting to.SocketFactorygetSocketFactory()Deprecated.Gets the socket factory for creating sockets to mongod.intgetSocketTimeout()Deprecated.Gets the socket timeout in milliseconds.intgetThreadsAllowedToBlockForConnectionMultiplier()Deprecated.Gets the multiplier which, when multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool.intgetW()Deprecated.Gets the "w" value, (number of writes), of the global WriteConcern.WriteConcerngetWriteConcern()Deprecated.Helper method to return the appropriate WriteConcern instance based on the current related options settings.intgetWtimeout()Deprecated.Gets the "wtimeout" value of the global WriteConcern.inthashCode()Deprecated.booleanisAlwaysUseMBeans()Deprecated.Gets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater.booleanisCursorFinalizerEnabled()Deprecated.Gets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close.booleanisFsync()Deprecated.Gets the "fsync" value of the global WriteConcern.booleanisJ()Deprecated.Gets the "j" value of the global WriteConcern.booleanisSafe()Deprecated.Returns whether the driver will use a WriteConcern of WriteConcern.ACKNOWLEDGED for all operations.booleanisSocketKeepAlive()Deprecated.Gets the flag that controls the socket keep alive feature that keeps a connection alive through firewalls.voidreset()Deprecated.Reset all settings to the default.voidsetAlwaysUseMBeans(boolean alwaysUseMBeans)Deprecated.Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater.voidsetConnectionsPerHost(int connections)Deprecated.Sets the maximum number of connections allowed per host for this Mongo instance.voidsetConnectTimeout(int timeoutMS)Deprecated.Sets the connection timeout in milliseconds.voidsetCursorFinalizerEnabled(boolean cursorFinalizerEnabled)Deprecated.Sets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close.voidsetDbDecoderFactory(DBDecoderFactory factory)Deprecated.Override the DBCallback factory.voidsetDbEncoderFactory(DBEncoderFactory factory)Deprecated.Override the encoding factory.voidsetDescription(String desc)Deprecated.Sets the description forMongoinstances created with these options.voidsetFsync(boolean sync)Deprecated.Sets the "fsync" value of the global WriteConcern.voidsetJ(boolean safe)Deprecated.Sets the "j" value of the global WriteConcern.voidsetMaxWaitTime(int timeMS)Deprecated.Sets the maximum wait time in milliseconds that a thread may wait for a connection to become available.voidsetReadPreference(ReadPreference readPreference)Deprecated.Specifies the read preference.voidsetSafe(boolean isSafe)Deprecated.Iftruethe driver will use a WriteConcern of WriteConcern.SAFE for all operations.voidsetSocketFactory(SocketFactory factory)Deprecated.Sets the socket factory for creating sockets to mongod.voidsetSocketKeepAlive(boolean keepAlive)Deprecated.Sets the flag that controls the socket keep alive feature that keeps a connection alive through firewallsSocket.setKeepAlive(boolean)Default is false.voidsetSocketTimeout(int timeoutMS)Deprecated.Sets the socket timeout in milliseconds It is used for I/O socket read and write operations(int)Default is 0 and means no timeout.voidsetThreadsAllowedToBlockForConnectionMultiplier(int threads)Deprecated.Sets the multiplier which, when multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool.voidsetW(int val)Deprecated.Sets the "w" value, (number of writes), of the global WriteConcern.voidsetWriteConcern(WriteConcern writeConcern)Deprecated.Sets the write concern.voidsetWtimeout(int timeoutMS)Deprecated.Sets the "wtimeout" value of the global WriteConcern.StringtoString()Deprecated.
-
-
-
Field Detail
-
description
public String description
Deprecated.The description forMongoinstances created with these options. This is used in various places like logging.
-
connectionsPerHost
public int connectionsPerHost
Deprecated.The maximum number of connections allowed per host for this Mongo instance. Those connections will be kept in a pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection. Default is 10.
-
threadsAllowedToBlockForConnectionMultiplier
public int threadsAllowedToBlockForConnectionMultiplier
Deprecated.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. All further threads will get an exception right away. For example if connectionsPerHost is 10 and threadsAllowedToBlockForConnectionMultiplier is 5, then up to 50 threads can wait for a connection. Default is 5.
-
maxWaitTime
public int maxWaitTime
Deprecated.The maximum wait time in milliseconds that a thread may wait for a connection to become available. Default is 120,000. A value of 0 means that it will not wait. A negative value means to wait indefinitely.
-
connectTimeout
public int connectTimeout
Deprecated.The connection timeout in milliseconds. A value of 0 means no timeout. It is used solely when establishing a new connectionSocket.connect(java.net.SocketAddress, int)Default is 10,000.
-
socketTimeout
public int socketTimeout
Deprecated.The socket timeout in milliseconds It is used for I/O socket read and write operationsSocket.setSoTimeout(int)Default is 0 and means no timeout.
-
socketKeepAlive
public boolean socketKeepAlive
Deprecated.This flag controls the socket keep alive feature that keeps a connection alive through firewallsSocket.setKeepAlive(boolean)Default is false.
-
readPreference
public ReadPreference readPreference
Deprecated.Specifies the read preference.
-
dbDecoderFactory
public DBDecoderFactory dbDecoderFactory
Deprecated.Override the DBCallback factory. Default is for the standard Mongo Java driver configuration.
-
dbEncoderFactory
public DBEncoderFactory dbEncoderFactory
Deprecated.Override the encoding factory. Default is for the standard Mongo Java driver configuration.
-
safe
public boolean safe
Deprecated.Iftruethe driver will use a WriteConcern of WriteConcern.SAFE for all operations. If w, wtimeout, fsync or j are specified, this setting is ignored. Default is false.
-
w
public int w
Deprecated.The "w" value, (number of writes), of the global WriteConcern. Default is 0.
-
wtimeout
public int wtimeout
Deprecated.The "wtimeout" value of the global WriteConcern. Default is 0.
-
fsync
public boolean fsync
Deprecated.The "fsync" value of the global WriteConcern. true indicates writes should wait for data to be written to server data file Default is false.
-
j
public boolean j
Deprecated.The "j" value of the global WriteConcern. true indicates writes should wait for a journaling group commit Default is false.
-
socketFactory
public SocketFactory socketFactory
Deprecated.Sets the socket factory for creating sockets to mongod Default is SocketFactory.getDefault()
-
cursorFinalizerEnabled
public boolean cursorFinalizerEnabled
Deprecated.Sets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close. If you are careful to always call the close method of DBCursor, then this can safely be set to false.
Default is true.
- See Also:
DBCursor.close()
-
writeConcern
public WriteConcern writeConcern
Deprecated.Sets the write concern. If this is not set, the write concern defaults to the combination of settings of the other write concern-related fields. If set, this will override all of the other write concern-related fields.
-
alwaysUseMBeans
public boolean alwaysUseMBeans
Deprecated.Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater. If false, the driver will use MXBeans if the VM is Java 6 or greater, and use MBeans if the VM is Java 5.Default is false.
-
-
Constructor Detail
-
MongoOptions
@Deprecated public MongoOptions()
Deprecated. useMongoClientOptionsCreates a new defaultMongoOptions. This class is deprecated, useMongoClientOptions.
-
MongoOptions
@Deprecated public MongoOptions(MongoClientOptions options)
Deprecated. useMongoClientOptionsCreates a newMongoOptionswith the given options. This class is deprecated, useMongoClientOptions.- Parameters:
options- the MongoClientOptions to copy values from into the new MongoOptions.
-
-
Method Detail
-
reset
public void reset()
Deprecated.Reset all settings to the default.
-
copy
public MongoOptions copy()
Deprecated.Copy this MongoOptions instance into a new instance.- Returns:
- the new MongoOptions with the same settings as this instance.
-
getWriteConcern
public WriteConcern getWriteConcern()
Deprecated.Helper method to return the appropriate WriteConcern instance based on the current related options settings.- Returns:
- a WriteConcern for the current MongoOptions.
-
setWriteConcern
public void setWriteConcern(WriteConcern writeConcern)
Deprecated.Sets the write concern. If this is not set, the write concern defaults to the combination of settings of the other write concern-related fields. If set, this will override all of the other write concern-related fields.- Parameters:
writeConcern- sets the write concern
-
getSocketFactory
public SocketFactory getSocketFactory()
Deprecated.Gets the socket factory for creating sockets to mongod. Default is SocketFactory.getDefault()- Returns:
- the socket factory for creating sockets to mongod
-
setSocketFactory
public void setSocketFactory(SocketFactory factory)
Deprecated.Sets the socket factory for creating sockets to mongod.- Parameters:
factory- sets the socket factory for creating sockets to mongod
-
getDescription
public String getDescription()
Deprecated.Gets the description forMongoinstances created with these options.- Returns:
- The description for
MongoClientinstances created with these options
-
setDescription
public void setDescription(String desc)
Deprecated.Sets the description forMongoinstances created with these options. This is used in various places like logging.- Parameters:
desc- The description forMongoinstances created with these options
-
getConnectionsPerHost
public int getConnectionsPerHost()
Deprecated.Gets the maximum number of connections allowed per host for this Mongo instance.- Returns:
- the maximum number of connections allowed per host for this Mongo instance
-
setConnectionsPerHost
public void setConnectionsPerHost(int connections)
Deprecated.Sets the maximum number of connections allowed per host for this Mongo instance. Those connections will be kept in a pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection. Default is 10.- Parameters:
connections- sets the maximum number of connections allowed per host for this Mongo instance
-
getThreadsAllowedToBlockForConnectionMultiplier
public int getThreadsAllowedToBlockForConnectionMultiplier()
Deprecated.Gets the multiplier which, when multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool.- Returns:
- the maximum number of threads that may be waiting for a connection
-
setThreadsAllowedToBlockForConnectionMultiplier
public void setThreadsAllowedToBlockForConnectionMultiplier(int threads)
Deprecated.Sets the multiplier which, when multiplied with the connectionsPerHost setting, gives the maximum number of threads that may be waiting for a connection to become available from the pool. All further threads will get an exception right away. For example if connectionsPerHost is 10 and threadsAllowedToBlockForConnectionMultiplier is 5, then up to 50 threads can wait for a connection. Default is 5.- Parameters:
threads- multiplied with connectionsPerHost, sets the maximum number of threads that may be waiting for a connection
-
getMaxWaitTime
public int getMaxWaitTime()
Deprecated.Gets the maximum wait time in milliseconds that a thread may wait for a connection to become available.- Returns:
- The maximum time in milliseconds that threads wait for a connection
-
setMaxWaitTime
public void setMaxWaitTime(int timeMS)
Deprecated.Sets the maximum wait time in milliseconds that a thread may wait for a connection to become available. Default is 120, 000. A value of 0 means that it will not wait. A negative value means to wait indefinitely.- Parameters:
timeMS- set the maximum time in milliseconds that threads wait for a connection
-
getConnectTimeout
public int getConnectTimeout()
Deprecated.Gets the connection timeout in milliseconds. A value of 0 means no timeout.- Returns:
- the connection timeout in milliseconds.
-
setConnectTimeout
public void setConnectTimeout(int timeoutMS)
Deprecated.Sets the connection timeout in milliseconds. A value of 0 means no timeout. It is used solely when establishing a new connectionSocket.connect(java.net.SocketAddress, int)Default is 10,000.- Parameters:
timeoutMS- set the connection timeout in milliseconds.
-
getSocketTimeout
public int getSocketTimeout()
Deprecated.Gets the socket timeout in milliseconds. 0 means no timeout.- Returns:
- The socket timeout in milliseconds
-
setSocketTimeout
public void setSocketTimeout(int timeoutMS)
Deprecated.Sets the socket timeout in milliseconds It is used for I/O socket read and write operations(int)Default is 0 and means no timeout.- Parameters:
timeoutMS- set the socket timeout in milliseconds
-
isSocketKeepAlive
public boolean isSocketKeepAlive()
Deprecated.Gets the flag that controls the socket keep alive feature that keeps a connection alive through firewalls.- Returns:
- connection keep-alive flag
-
setSocketKeepAlive
public void setSocketKeepAlive(boolean keepAlive)
Deprecated.Sets the flag that controls the socket keep alive feature that keeps a connection alive through firewallsSocket.setKeepAlive(boolean)Default is false.- Parameters:
keepAlive- set connection keep-alive flag
-
getDbDecoderFactory
public DBDecoderFactory getDbDecoderFactory()
Deprecated.Gets the DBCallback factory.- Returns:
- the DBCallback decoding factory
-
setDbDecoderFactory
public void setDbDecoderFactory(DBDecoderFactory factory)
Deprecated.Override the DBCallback factory. Default is for the standard Mongo Java driver configuration.- Parameters:
factory- sets the DBCallback decoding factory
-
getDbEncoderFactory
public DBEncoderFactory getDbEncoderFactory()
Deprecated.Gets the encoding factory.- Returns:
- the encoding factory
-
setDbEncoderFactory
public void setDbEncoderFactory(DBEncoderFactory factory)
Deprecated.Override the encoding factory. Default is for the standard Mongo Java driver configuration.- Parameters:
factory- sets the encoding factory
-
isSafe
public boolean isSafe()
Deprecated.Returns whether the driver will use a WriteConcern of WriteConcern.ACKNOWLEDGED for all operations.- Returns:
- true if driver uses WriteConcern.SAFE for all operations.
-
setSafe
public void setSafe(boolean isSafe)
Deprecated.Iftruethe driver will use a WriteConcern of WriteConcern.SAFE for all operations. If w, wtimeout, fsync or j are specified, this setting is ignored. Default is false.- Parameters:
isSafe- true if driver uses WriteConcern.SAFE for all operations.
-
getW
public int getW()
Deprecated.Gets the "w" value, (number of writes), of the global WriteConcern.- Returns:
- value returns the number of writes of the global WriteConcern.
-
setW
public void setW(int val)
Deprecated.Sets the "w" value, (number of writes), of the global WriteConcern. Default is 0.- Parameters:
val- set the number of writes of the global WriteConcern.
-
getWtimeout
public int getWtimeout()
Deprecated.Gets the "wtimeout" value of the global WriteConcern.- Returns:
- timeout in millis for write operation
-
setWtimeout
public void setWtimeout(int timeoutMS)
Deprecated.Sets the "wtimeout" value of the global WriteConcern. Default is 0.- Parameters:
timeoutMS- sets timeout in millis for write operation
-
isFsync
public boolean isFsync()
Deprecated.Gets the "fsync" value of the global WriteConcern. True indicates writes should wait for data to be written to server data file- Returns:
- true if global write concern is set to fsync
-
setFsync
public void setFsync(boolean sync)
Deprecated.Sets the "fsync" value of the global WriteConcern. True indicates writes should wait for data to be written to server data file Default is false.- Parameters:
sync- sets global write concern's fsync safe value
-
isJ
public boolean isJ()
Deprecated.Gets the "j" value of the global WriteConcern. True indicates writes should wait for a journaling group commit- Returns:
- true if global write concern is set to journal safe
-
setJ
public void setJ(boolean safe)
Deprecated.Sets the "j" value of the global WriteConcern. True indicates writes should wait for a journaling group commit. Default is false.- Parameters:
safe- sets global write concern's journal safe value
-
getReadPreference
public ReadPreference getReadPreference()
Deprecated.Gets the read preference.- Returns:
- the read preference
-
setReadPreference
public void setReadPreference(ReadPreference readPreference)
Deprecated.Specifies the read preference.- Parameters:
readPreference- the read preference
-
isCursorFinalizerEnabled
public boolean isCursorFinalizerEnabled()
Deprecated.Gets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close.- Returns:
- whether DBCursor finalizer is enabled
-
setCursorFinalizerEnabled
public void setCursorFinalizerEnabled(boolean cursorFinalizerEnabled)
Deprecated.Sets whether there is a a finalize method created that cleans up instances of DBCursor that the client does not close. If you are careful to always call the close method of DBCursor, then this can safely be set to false. Default is true.- Parameters:
cursorFinalizerEnabled- whether cursor finalizer is enabled
-
isAlwaysUseMBeans
public boolean isAlwaysUseMBeans()
Deprecated.Gets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater. If false, the driver will use MXBeans if the VM is Java 6 or greater, and use MBeans if the VM is Java 5.- Returns:
- true if the driver should always use MBeans, regardless of VM
-
setAlwaysUseMBeans
public void setAlwaysUseMBeans(boolean alwaysUseMBeans)
Deprecated.Sets whether JMX beans registered by the driver should always be MBeans, regardless of whether the VM is Java 6 or greater. If false, the driver will use MXBeans if the VM is Java 6 or greater, and use MBeans if the VM is Java 5. Default is false.- Parameters:
alwaysUseMBeans- sets whether the driver should always use MBeans, regardless of VM
-
getRequiredReplicaSetName
public String getRequiredReplicaSetName()
Deprecated.Gets the required replica set name that this client should be connecting to.- Returns:
- the required replica set name, or null if none is required
- Since:
- 2.12
-
-