@NotThreadSafe public static final class ServerSettings.Builder extends Object
Modifier and Type | Method | Description |
---|---|---|
ServerSettings.Builder |
addServerListener(ServerListener serverListener) |
Add a server listener.
|
ServerSettings.Builder |
addServerMonitorListener(ServerMonitorListener serverMonitorListener) |
Adds a server monitor listener.
|
ServerSettings.Builder |
applyConnectionString(ConnectionString connectionString) |
Takes the settings from the given
ConnectionString and applies them to the builder |
ServerSettings.Builder |
applySettings(ServerSettings serverSettings) |
Applies the serverSettings to the builder
|
ServerSettings |
build() |
Create a new ServerSettings from the settings applied to this builder.
|
ServerSettings.Builder |
heartbeatFrequency(long heartbeatFrequency,
TimeUnit timeUnit) |
Sets the frequency that the cluster monitor attempts to reach each server.
|
ServerSettings.Builder |
minHeartbeatFrequency(long minHeartbeatFrequency,
TimeUnit timeUnit) |
Sets the minimum heartbeat frequency.
|
public ServerSettings.Builder applySettings(ServerSettings serverSettings)
Note: Overwrites all existing settings
serverSettings
- the serverSettingspublic ServerSettings.Builder heartbeatFrequency(long heartbeatFrequency, TimeUnit timeUnit)
heartbeatFrequency
- the heartbeat frequencytimeUnit
- the time unitpublic ServerSettings.Builder minHeartbeatFrequency(long minHeartbeatFrequency, TimeUnit timeUnit)
minHeartbeatFrequency
- the minimum heartbeat frequencytimeUnit
- the time unitpublic ServerSettings.Builder addServerListener(ServerListener serverListener)
serverListener
- the non-null server listenerpublic ServerSettings.Builder addServerMonitorListener(ServerMonitorListener serverMonitorListener)
serverMonitorListener
- the non-null server monitor listenerpublic ServerSettings.Builder applyConnectionString(ConnectionString connectionString)
ConnectionString
and applies them to the builderconnectionString
- the connection string containing details of how to connect to MongoDBpublic ServerSettings build()