@NotThreadSafe public static class ServerSettings.Builder extends Object
Constructor and Description |
---|
Builder() |
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,
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 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
- a URI containing details of how to connect to MongoDBpublic ServerSettings build()