@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)
Take the settings from the given ConnectionString and add them 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 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
- a URI containing details of how to connect to MongoDBpublic ServerSettings build()