@Immutable public final class MongoClientSettings extends Object
MongoClient
.Modifier and Type | Class | 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 | 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, or null if not set.
|
List<CommandListener> |
getCommandListeners() |
Gets the list of added
CommandListener . |
List<MongoCompressor> |
getCompressorList() |
Gets the compressors to use for compressing messages to the server.
|
ConnectionPoolSettings |
getConnectionPoolSettings() |
Gets the settings for the connection provider in a settings object.
|
MongoCredential |
getCredential() |
Gets the credential.
|
static CodecRegistry |
getDefaultCodecRegistry() |
Gets the default codec registry.
|
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.
|
boolean |
getRetryWrites() |
Returns true if writes should be retried if they fail due to a network error.
|
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 CodecRegistry getDefaultCodecRegistry()
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()
@Nullable public MongoCredential getCredential()
public WriteConcern getWriteConcern()
Default is WriteConcern.ACKNOWLEDGED
.
WriteConcern.ACKNOWLEDGED
public boolean getRetryWrites()
public ReadConcern getReadConcern()
public CodecRegistry getCodecRegistry()
@Nullable public StreamFactoryFactory getStreamFactoryFactory()
StreamFactory
.public List<CommandListener> getCommandListeners()
CommandListener
.
The default is an empty list.
@Nullable public String getApplicationName()
Default is null.
public List<MongoCompressor> getCompressorList()
Default is the empty list.
public ClusterSettings getClusterSettings()
public SslSettings getSslSettings()
public SocketSettings getSocketSettings()
MongoClientSettings
instance.SocketSettings
public SocketSettings getHeartbeatSocketSettings()
SocketSettings
public ConnectionPoolSettings getConnectionPoolSettings()
MongoClientSettings
instance that relate to the
connection provider.ConnectionPoolSettings
public ServerSettings getServerSettings()
MongoClientSettings
instance.ServerSettings