@NotThreadSafe public static class ServerDescription.Builder extends java.lang.Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
ServerDescription.Builder |
address(ServerAddress address)
Sets the address of the server.
|
ServerDescription.Builder |
arbiters(java.util.Set<java.lang.String> arbiters)
Sets the arbiters in the replica set
|
ServerDescription |
build()
Create a new ServerDescription from the settings in this builder.
|
ServerDescription.Builder |
canonicalAddress(java.lang.String canonicalAddress)
Sets the canonical host name and port of this server.
|
ServerDescription.Builder |
electionId(ObjectId electionId)
Sets the electionId reported by this server.
|
ServerDescription.Builder |
exception(java.lang.Throwable exception)
Sets the exception thrown while attempting to determine the server description.
|
ServerDescription.Builder |
hosts(java.util.Set<java.lang.String> hosts)
Sets all members of the replica set that are neither hidden, passive, nor arbiters.
|
ServerDescription.Builder |
lastUpdateTimeNanos(long lastUpdateTimeNanos)
Sets the last update time for this description, which is simply the time that the server description was created.
|
ServerDescription.Builder |
lastWriteDate(java.util.Date lastWriteDate)
Sets the lastWriteDate reported by this server
|
ServerDescription.Builder |
logicalSessionTimeoutMinutes(java.lang.Integer logicalSessionTimeoutMinutes)
Sets the session timeout in minutes.
|
ServerDescription.Builder |
maxDocumentSize(int maxDocumentSize)
The maximum permitted size of a BSON object in bytes for this mongod process.
|
ServerDescription.Builder |
maxWireVersion(int maxWireVersion)
The latest version of the wire protocol that this MongoDB server is capable of using to communicate with clients.
|
ServerDescription.Builder |
minWireVersion(int minWireVersion)
The earliest version of the wire protocol that this MongoDB server is capable of using to communicate with clients.
|
ServerDescription.Builder |
ok(boolean ok)
The isOK() result from requesting this information from MongoDB
|
ServerDescription.Builder |
passives(java.util.Set<java.lang.String> passives)
Sets the passive members of the replica set.
|
ServerDescription.Builder |
primary(java.lang.String primary)
Sets the address of the current primary in the replica set
|
ServerDescription.Builder |
roundTripTime(long roundTripTime,
java.util.concurrent.TimeUnit timeUnit)
Set the time it took to make the round trip for requesting this information from the server
|
ServerDescription.Builder |
setName(java.lang.String setName)
Sets the name of the replica set
|
ServerDescription.Builder |
setVersion(java.lang.Integer setVersion)
Sets the setVersion reported by this server.
|
ServerDescription.Builder |
state(ServerConnectionState state)
The current state of the connection to the server.
|
ServerDescription.Builder |
tagSet(TagSet tagSet)
A set of any tags assigned to this member.
|
ServerDescription.Builder |
type(ServerType type)
Sets the type of the server, for example whether it's a standalone or in a replica set.
|
ServerDescription.Builder |
version(ServerVersion version)
Sets the server version
|
public ServerDescription.Builder address(ServerAddress address)
address
- the address of the serverpublic ServerDescription.Builder canonicalAddress(java.lang.String canonicalAddress)
canonicalAddress
- the host name and port as a stringpublic ServerDescription.Builder type(ServerType type)
type
- the Server typepublic ServerDescription.Builder hosts(java.util.Set<java.lang.String> hosts)
hosts
- A Set of strings in the format of "[hostname]:[port]" that contains all members of the replica set that are neither
hidden, passive, nor arbiters.public ServerDescription.Builder passives(java.util.Set<java.lang.String> passives)
passives
- A Set of strings in the format of "[hostname]:[port]" listing all members of the replica set which have a
priority of 0.public ServerDescription.Builder arbiters(java.util.Set<java.lang.String> arbiters)
arbiters
- A Set of strings in the format of "[hostname]:[port]" containing all members of the replica set that are
arbiters.public ServerDescription.Builder primary(java.lang.String primary)
primary
- A string in the format of "[hostname]:[port]" listing the current primary member of the replica set.public ServerDescription.Builder maxDocumentSize(int maxDocumentSize)
maxDocumentSize
- the maximum size a document can bepublic ServerDescription.Builder tagSet(TagSet tagSet)
tagSet
- a TagSet with all the tags for this server.public ServerDescription.Builder roundTripTime(long roundTripTime, java.util.concurrent.TimeUnit timeUnit)
roundTripTime
- the time takentimeUnit
- the units of the time takenpublic ServerDescription.Builder setName(java.lang.String setName)
setName
- the name of the replica setpublic ServerDescription.Builder ok(boolean ok)
ok
- true if the request executed correctlypublic ServerDescription.Builder state(ServerConnectionState state)
state
- ServerConnectionState representing whether the server has been successfully connected topublic ServerDescription.Builder version(ServerVersion version)
version
- a ServerVersion representing which version of MongoDB is running on this serverpublic ServerDescription.Builder minWireVersion(int minWireVersion)
minWireVersion
- the minimum protocol version supported by this serverpublic ServerDescription.Builder maxWireVersion(int maxWireVersion)
maxWireVersion
- the maximum protocol version supported by this serverpublic ServerDescription.Builder electionId(ObjectId electionId)
electionId
- the electionIdpublic ServerDescription.Builder setVersion(java.lang.Integer setVersion)
setVersion
- the set versionpublic ServerDescription.Builder lastWriteDate(java.util.Date lastWriteDate)
lastWriteDate
- the last write date, which may be null for servers prior to 3.4public ServerDescription.Builder lastUpdateTimeNanos(long lastUpdateTimeNanos)
System.nanoTime()
should be used to initialize this value.lastUpdateTimeNanos
- the last update time of this server descriptionpublic ServerDescription.Builder logicalSessionTimeoutMinutes(java.lang.Integer logicalSessionTimeoutMinutes)
logicalSessionTimeoutMinutes
- the session timeout in minutes, or null if sessions are not supported by this serverpublic ServerDescription.Builder exception(java.lang.Throwable exception)
exception
- the exceptionpublic ServerDescription build()
Copyright © 2010 - 2020 Adobe. All Rights Reserved