@NotThreadSafe public static final class ServerSettings.Builder extends java.lang.Object
Modifier and Type | Method and 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,
java.util.concurrent.TimeUnit timeUnit)
Sets the frequency that the cluster monitor attempts to reach each server.
|
ServerSettings.Builder |
minHeartbeatFrequency(long minHeartbeatFrequency,
java.util.concurrent.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, java.util.concurrent.TimeUnit timeUnit)
heartbeatFrequency
- the heartbeat frequencytimeUnit
- the time unitpublic ServerSettings.Builder minHeartbeatFrequency(long minHeartbeatFrequency, java.util.concurrent.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()
Copyright © 2010 - 2020 Adobe. All Rights Reserved