@Immutable public final class MongoClientSettings extends Object
MongoClient
.Modifier and Type | Class and Description |
---|---|
static class |
MongoClientSettings.Builder
A builder for
MongoClientSettings so that MongoClientSettings can be immutable, and to support easier construction
through chaining. |
Modifier and Type | Method and Description |
---|---|
static MongoClientSettings.Builder |
builder()
Convenience method to create a Builder.
|
static MongoClientSettings.Builder |
builder(MongoClientSettings settings)
Convenience method to create a from an existing
MongoClientSettings . |
String |
getApplicationName()
Gets the logical name of the application using this MongoClient.
|
ClusterSettings |
getClusterSettings()
Gets the cluster settings.
|
CodecRegistry |
getCodecRegistry()
The codec registry to use.
|
List<CommandListener> |
getCommandListeners()
Gets the list of added
CommandListener . |
ConnectionPoolSettings |
getConnectionPoolSettings()
Gets the settings for the connection provider in a settings object.
|
List<MongoCredential> |
getCredentialList()
Gets the credential list.
|
SocketSettings |
getHeartbeatSocketSettings()
Gets the connection settings for the heartbeat thread (the background task that checks the state of the cluster) wrapped in a
settings object.
|
ReadConcern |
getReadConcern()
The read concern to use.
|
ReadPreference |
getReadPreference()
The read preference to use for queries, map-reduce, aggregation, and count.
|
ServerSettings |
getServerSettings()
Gets the server-specific settings wrapped in a settings object.
|
SocketSettings |
getSocketSettings()
Gets the connection-specific settings wrapped in a settings object.
|
SslSettings |
getSslSettings()
Gets the SSL settings.
|
StreamFactoryFactory |
getStreamFactoryFactory()
Gets the factory to use to create a
StreamFactory . |
WriteConcern |
getWriteConcern()
The write concern to use.
|
public static MongoClientSettings.Builder builder()
public static MongoClientSettings.Builder builder(MongoClientSettings settings)
MongoClientSettings
.settings
- create a builder from existing settingspublic ReadPreference getReadPreference()
Default is ReadPreference.primary()
.
ReadPreference.primary()
public List<MongoCredential> getCredentialList()
public WriteConcern getWriteConcern()
Default is WriteConcern.ACKNOWLEDGED
.
WriteConcern.ACKNOWLEDGED
public ReadConcern getReadConcern()
public CodecRegistry getCodecRegistry()
MongoClient
will be able to encode and decode instances of Document
.MongoClient.getDatabase(java.lang.String)
public StreamFactoryFactory getStreamFactoryFactory()
StreamFactory
.public List<CommandListener> getCommandListeners()
CommandListener
. The default is an empty list.public String getApplicationName()
Default is null.
public ClusterSettings getClusterSettings()
public SslSettings getSslSettings()
public SocketSettings getSocketSettings()
MongoClientSettings
instance.SocketSettings
public SocketSettings getHeartbeatSocketSettings()
MongoClientSettings
instance.SocketSettings
public ConnectionPoolSettings getConnectionPoolSettings()
MongoClientSettings
instance that relate to the
connection provider.ConnectionPoolSettings
public ServerSettings getServerSettings()
MongoClientSettings
instance.ServerSettings